[postgis-users] Inconsistent results on ST_Intersects and ST_Distance

Paul Ramsey pramsey at cleverelephant.ca
Wed Feb 26 08:06:38 PST 2020



> On Feb 26, 2020, at 2:02 AM, Palmetzhofer Dietmar <Dietmar.Palmetzhofer at vorarlberg.at> wrote:
> 
> I have a simple LINE-Geometry and a POINT, that I want to query, if it intersects the line.
> The result ist, that ST_Intersects gives „FALSE“, and ST_Distance gives „0“. So, this is contradictory. An analysis with JTS shows, that there is a distance of 6.611191059663252E-13.
> Should ST_Distance not also return this result?
> 

They are different code lines, and have different tolerances. At some point “very small” becomes “zero”, and unfortunately these two lines have different places where that happens. If we patched up this case you’d just find a new one at E-20 :) the boundary between real math and discrete math exists and is manifest in the code.

P


More information about the postgis-users mailing list