wiki:ToleranceDiscussion

Version 1 (modified by nicklas, 12 years ago) ( diff )

What functions need a tolerance/precision and how should it be implemented

Aiming at 2.1 The double precision floating point values in the coordinates and function returns sometimes makes things difficult.
It is for instance impossible to find a point that is intersecting a linestring except some special cases.

What makes things difficult is that the number of decimals that the double precision value can hold depends on how many digits is needed on the left of the decimal sign.

The good thing is that double precision hold way more precision than needed in mapping. It is not common to use maps for better precision than decimeters or centimeters.

So, we need some way to do the calculations with best possible precision and then from a given tolerance or decided from the precision of the input take the inaccuracy in account.

List of functions that should take tolerance and precision.

Native PostGIS

  • ST_Distance, would be nice if the output was based on the input precision.

In GEOS

  • ST_Intersects with tolerance

Should behave like ST_Dwithin with the tolerance as the second argument. But ST_Intersects is way faster than ST_Dwithin so hopefully it is possible to implement in that algoritm

Note: See TracWiki for help on using the wiki.