I have two polygons where one should cover the other. They were created in qgis using snapping, however when I checked their topology with postgis it turned out one point on the inner polygon registered as outside the covering polygon. This seems to regularly happen when I create an inner polygon with an edge that lies on an outer polygon.
When I use ST_Equals on the point supposedly outside the polygon and the closest point on the outer polygon it returns true, but when I check whether the polygon and the point are touching it returns false.
Here's the query I'm running:
--CTE with points that are outside the outer polygon (only one in this specific case) WITH outsidepoints AS ( SELECT dump.geom FROM ( SELECT geom, ST_Covers((SELECT geom from zone WHERE gid = 403), geom) FROM ST_DumpPoints((SELECT geom from zone WHERE gid = 416)) ) AS dump WHERE st_covers = false ) --Check if closest point on outer polygon and "outside" point on inner polygon are equal --Check if "outside" point touches outer polygon SELECT ST_Equals(geom, ST_ClosestPoint((SELECT geom from zone WHERE gid = 403), geom)), ST_Touches(geom, (SELECT geom from zone WHERE gid = 403)) FROM outsidepoints
The result is T, F
Is this some kind of floating point error? Is there a tolerance parameter I need to set for these calculations?