[postgis-users] postgis-users Digest, Vol 152, Issue 3

Mark Wynter mark at dimensionaledge.com
Sat Oct 4 05:18:21 PDT 2014


Don't have the benefit of seeing your image...
For those that intersect, what about ST_difference to rid overlaps and ST_Snap to fill voids... 

Or ST_Buffer both, take the intersection, union it to one of the polys and difference it with the first original 

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 ... 

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.

HTH

Sent from my iPhone

> On 4 Oct 2014, at 4:30 am, postgis-users-request at lists.osgeo.org wrote:
> 
> Send postgis-users mailing list submissions to
>    postgis-users at lists.osgeo.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>    http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> or, via email, send a message with subject or body 'help' to
>    postgis-users-request at lists.osgeo.org
> 
> You can reach the person managing the list at
>    postgis-users-owner at lists.osgeo.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of postgis-users digest..."
> 
> 
> Today's Topics:
> 
>   1. A little tired of non-noded intersections between    polygons --
>      node them all (John Abraham)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 3 Oct 2014 12:29:30 -0600
> From: John Abraham <jea at hbaspecto.com>
> To: postgis-users at lists.osgeo.org
> Subject: [postgis-users] A little tired of non-noded intersections
>    between    polygons -- node them all
> Message-ID: <5471EFE5-B80B-45E5-8154-B8C3F691BBDD at hbaspecto.com>
> Content-Type: text/plain; charset="windows-1252"
> 
> 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-0001.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-0001.png>
> 
> ------------------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> 
> End of postgis-users Digest, Vol 152, Issue 3
> *********************************************


More information about the postgis-users mailing list