<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><span></span></div><div><span>Yes that was basically my algorithm: combinations of buffer, intersection, then difference. </span><br><span></span><br><span>I was using st_makevalid too, it didn't help, everything was considered valid, yet I was getting errors. </span><br><span></span><br><span>I was unaware of st_snap as a separate function than st_snaptogrid. Maybe that was the missing piece. Thanks. </span><br><span></span><br><span>Nonetheless, the triangulation algorithm from Martijn seems so much cleaner and more powerful than any of this. </span><a href="http://tudelft-gist.github.io/pprepair/">http://tudelft-gist.github.io/pprepair/</a> .  I don't even see a reason to try st_snap. <br><span></span><br><span>--</span><br><span>John Abraham</span><br><span></span><br><span>Sent from my iPhone, please excuse any typos. </span><br><span></span><br><blockquote type="cite"><span>On Oct 4, 2014, at 6:18 AM, Mark Wynter <<a href="mailto:mark@dimensionaledge.com">mark@dimensionaledge.com</a>> wrote:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Don't have the benefit of seeing your image...</span><br></blockquote><blockquote type="cite"><span>For those that intersect, what about ST_difference to rid overlaps and ST_Snap to fill voids... </span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Or ST_Buffer both, take the intersection, union it to one of the polys and difference it with the first original </span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I recall a project 6 months back where client handed me a bunch of polys that lacked common edges because they were created almost freehand ... </span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I can't pull up my code because I'm on annual leave, but I recall I wrote a stored procedure that looped through each poly at a time, found the nearest, and used a combination of functions to produce a valid edge between each pair.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>HTH</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Sent from my iPhone</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>On 4 Oct 2014, at 4:30 am, <a href="mailto:postgis-users-request@lists.osgeo.org">postgis-users-request@lists.osgeo.org</a> wrote:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Send postgis-users mailing list submissions to</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>  <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>To subscribe or unsubscribe via the World Wide Web, visit</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>  <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>or, via email, send a message with subject or body 'help' to</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>  <a href="mailto:postgis-users-request@lists.osgeo.org">postgis-users-request@lists.osgeo.org</a></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>You can reach the person managing the list at</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>  <a href="mailto:postgis-users-owner@lists.osgeo.org">postgis-users-owner@lists.osgeo.org</a></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>When replying, please edit your Subject line so it is more specific</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>than "Re: Contents of postgis-users digest..."</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Today's Topics:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span> 1. A little tired of non-noded intersections between    polygons --</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>    node them all (John Abraham)</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>----------------------------------------------------------------------</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Message: 1</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Date: Fri, 3 Oct 2014 12:29:30 -0600</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>From: John Abraham <<a href="mailto:jea@hbaspecto.com">jea@hbaspecto.com</a>></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>To: <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Subject: [postgis-users] A little tired of non-noded intersections</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>  between    polygons -- node them all</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Message-ID: <<a href="mailto:5471EFE5-B80B-45E5-8154-B8C3F691BBDD@hbaspecto.com">5471EFE5-B80B-45E5-8154-B8C3F691BBDD@hbaspecto.com</a>></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Content-Type: text/plain; charset="windows-1252"</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>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...</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>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.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>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.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>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.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>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 </span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>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</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>type of errors.  But ST_Node only works on lines, not polygons.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>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?</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Feeling frustrated,</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>--</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>John Abraham</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span><a href="mailto:jea@hbaspecto.com">jea@hbaspecto.com</a></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>403-232-1060</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>-------------- next part --------------</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>An HTML attachment was scrubbed...</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>URL: <<a href="http://lists.osgeo.org/pipermail/postgis-users/attachments/20141003/81ea8a07/attachment-0001.html">http://lists.osgeo.org/pipermail/postgis-users/attachments/20141003/81ea8a07/attachment-0001.html</a>></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>-------------- next part --------------</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>A non-text attachment was scrubbed...</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Name: Screen Shot 2014-10-03 at 12.08.00 PM.png</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Type: image/png</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Size: 7887 bytes</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Desc: not available</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>URL: <<a href="http://lists.osgeo.org/pipermail/postgis-users/attachments/20141003/81ea8a07/attachment-0001.png">http://lists.osgeo.org/pipermail/postgis-users/attachments/20141003/81ea8a07/attachment-0001.png</a>></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>------------------------------</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>_______________________________________________</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>postgis-users mailing list</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span><a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span><a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>End of postgis-users Digest, Vol 152, Issue 3</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>*********************************************</span><br></blockquote></blockquote><blockquote type="cite"><span>_______________________________________________</span><br></blockquote><blockquote type="cite"><span>postgis-users mailing list</span><br></blockquote><blockquote type="cite"><span><a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a></span><br></blockquote><blockquote type="cite"><span><a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></span><br></blockquote></div></body></html>