[postgis-users] geos result sets

Martin Davis mbdavis at VividSolutions.com
Thu Feb 26 10:35:53 PST 2004


> Is it likely that GEOS, being mathematically correct, will 
> produce different answers due to the effect of such tolerances?
> 
> eg: calclate the mid point of a simple line defined by two 
> points. Add that point to a copy of the line. Due to 
> precision constraints, unless the line is vertical or 
> horizontal, if you draw both lines together, you will 
> generally have a triangle, (very narrow, but still a triangle).
> 
> So at the precision limits, fuzziness is always going to be 
> there, the question is how much do we allow for this, if at 
> all? 

JTS/GEOS is not in fact "mathematically correct" (as you use the term) -
it is bound by the same precision limitations as any system that uses
floating point numbers to represent continuous quantities.  As you say,
when it computes an intersection point of two line segments (which is
THE fundamental computation in constructive spatial functions) it can
only compute an approximation to the actual value.  This is unavoidable.
The best you can hope for is that the computation is robust (i.e. does
not fail unexpectedly due to topological inconsistencies caused by the
inaccurate intersection points) and that the answers produced are
topologically correct and "close" to the right answer (according to some
measure).  

This is a HARD problem to do in general.  JTS/GEOS are pretty good, but
the spatial functions are unfortunately not 100% robust.  They should
produce "close" results, however.  (which is not always the case - I
have seen systems which always produce an answer - but it is sometimes
completely the wrong one!).

I should emphasize that the above applies to the spatial boolean
functions only.  Predicates are not bound by the precison limitation,
since the range of their outputs can be represented precisely (i.e.
true/false).  The predicates in JTS/GEOS are 100% robust and correct.
Also, in JTS 1.4 buffering is 100% robust (and correct given that
buffers are necessarily approximations anyway).

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046

 



More information about the postgis-users mailing list