0

Recently, I encountered a very strange phenomenon. I have to split a multilinestring on the point of touching another line, sounds complicated but it is just preprocessing to build a graph.

Now the problem is - I calculate the shortest line to the MultiLineString(). I get a linestring now I take the point which is supposed to be on the MultiLineString(). But according to PostGIS it is spatialy disjoint! calculating the length to the MultiLineString() the result is 0.

Where does this Problem come from?

3
  • 1
    It may come from rounding errors in computing. Snapping to grid usually helps postgis.net/docs/manual-2.0/ST_SnapToGrid.htm.
    – user30184
    Commented May 7, 2016 at 14:52
  • I is a rounding error for sure! But it shouldn't effect the result imho. Is there a common solution? - postgis.net/docs/ST_Intersects.html indicates the distance below 0.00001m
    – Styp
    Commented May 7, 2016 at 14:53
  • That tolerance is for geography. As far as I know there is no tolerance at all for geometry if SnapToGrid is not used.
    – user30184
    Commented May 7, 2016 at 15:30

1 Answer 1

3

Could be a classic double precision floating point "normal issue".

Check this page about tolerance in Postgis: https://trac.osgeo.org/postgis/wiki/ToleranceDiscussion

Verify also the validity of geometries. (ST_IsValid)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.