[postgis-users] Inconsistent results on ST_Intersects and ST_Distance

Palmetzhofer Dietmar Dietmar.Palmetzhofer at vorarlberg.at
Thu Feb 27 05:28:12 PST 2020


For practical anlysis in GIS, I am considering 0-tolerance is a problem. But I do not want to start a new tolerance-discussion here. I was just confused, because I read that ST_Intersects uses a tolerance, and assumed, ST_Intersection also uses this tolerance. But ST_Intersection does not (my fault - I did not read the documentation well).
Using postgis.topology and adding both tables to it solves the problem. When creating the topology I can specify a tolerance, and because a vertex is inserted at that specific position for both geometries, the intersection afterwards gives the expected results.

Regards,
Didi

-----Ursprüngliche Nachricht-----
Von: postgis-users <postgis-users-bounces at lists.osgeo.org> Im Auftrag von Paul Ramsey
Gesendet: Mittwoch, 26. Februar 2020 17:07
An: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
Betreff: Re: [postgis-users] Inconsistent results on ST_Intersects and ST_Distance



> 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
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users


More information about the postgis-users mailing list