[postgis-users] A little tired of non-noded intersections between polygons -- node them all
John Abraham
jea at hbaspecto.com
Fri Oct 3 11:29:30 PDT 2014
I’m trying to clean up a geometry layer, a division of a province into smaller areas. Once it’s cleaned up I’d like to start using a topology, so that no-one else ever has to deal with these problems… but… meanwhile...
I keep getting non-noded intersections or other topology exceptions when I’m searching for (or removing) overlapping polygons or searching for (or adding in) missing bits between polygons.
I’ve used all kinds of combinations of st_buffer(0), st_cleangeometry(), custom versions of st_cleangeometry(), and st_snaptogrid to try to fix things.
I’ve noticed a pattern with the types of problems I’m currently dealing with. Basically, they are non-noded intersections between polygon edges. Eg, there is a polygon that has a not-quite-exactly-north-south boundary on its west side that it shares with its western neighbor. But the neighbor's boundary is longer, extending north past the corner of the original, and it’s defined by a different pair of points. If the image comes through, you can see it below. The Greenish polygon obviously has node at its north-west corner, but the brownish polygon, to the west of it, does not have a node at that location, its boundary is longer so is defined by more distant end points.
I’m wondering if I could use something like st_node to add a node in the western polygon, so the corner between them is defined identically on both sides? Then, presumably, I wouldn’t be getting these
ERROR: GEOSUnaryUnion: TopologyException: found non-noded intersection between LINESTRING (144297 5.66546e+006, 144201 5.67011e+006) and LINESTRING (144203 5.67002e+006, 144204 5.67002e+006) at 144203.19006961776 5670017.7300232062
type of errors. But ST_Node only works on lines, not polygons.
PS I was watching Paul Ramsey’s presentation on the web from Foss4G and I agree that PostGIS is fantastic and gaining so much momentum, and perhaps even “asymptotically approaching perfection”. But these types of topology errors always seem to trip me up. Isn’t there something that can be done in the underlying GEOS functions to make these less common? Or is everything an edge case that needs a special algorithm? I’m frankly rather surprised that these errors don’t seem common for more people (based on my limited google search hits): are others not using ST_Union or ST_Intersects very much? Or does everyone else have boundaries that are defined in topologies, or with every point specified? Or is there just some trick, that no-one’s ever told me about, to add in the necessary points on edges so that identical line segments are defined by the same pairs of points?
Feeling frustrated,
--
John Abraham
jea at hbaspecto.com
403-232-1060
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20141003/81ea8a07/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2014-10-03 at 12.08.00 PM.png
Type: image/png
Size: 7887 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20141003/81ea8a07/attachment.png>
More information about the postgis-users
mailing list