<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">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...<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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 </div><div><div style="margin: 0px; font-size: 13px; font-family: Courier;">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</div></div><div>type of errors. But ST_Node only works on lines, not polygons.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><img apple-inline="yes" id="E1AB0D97-0672-493B-8EAD-7DE808D169D3" height="381" width="418" apple-width="yes" apple-height="yes" src="cid:D3675F50-5B11-4FE4-A37B-464F2580918D"></div><div><br></div><div>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?</div><div><br></div><div>Feeling frustrated,<br><div> </div><div><span style="orphans: 2; text-align: -webkit-auto; widows: 2;">--</span></div><div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><div>John Abraham</div><div><a href="mailto:jea@hbaspecto.com">jea@hbaspecto.com</a></div><div>403-232-1060</div></span>
</div>
<br></div></div></body></html>