[postgis-users] Returning contiguous linestrings

Sandro Santilli strk at keybit.net
Wed Apr 18 04:36:58 PDT 2012

On Wed, Apr 18, 2012 at 03:57:52AM -0700, Bob Pawley wrote:

> I have, lets say, eight rows each containing a linestring, that,
> when put together forms a closed shape or polygon.
> I can fairly easily detect one of the linestrings in this polygon.
> Since each linestring has a endpoint at (or near) the startpoint of
> the next linestring in the polygon, I am wondering if there is a
> method of detecting the other linestrings, that forms a closed
> polygon, from that one contact.
> From this I would compare the shape to known shapes to identify it.

topology.GetRingEdges does the walking around a ring, starting from
an edge. You'd have to build the topology first, making sure that
endpoints do close. A tolerance >= the max distance between those
endpoint might be enough.


  |   __/  |    Delivering high quality PostGIS 2.0 !
  |  / 2.0 |    http://strk.keybit.net - http://vizzuality.com

More information about the postgis-users mailing list