[postgis-users] Turn a Polygon into Lines

Kevin Neufeld kneufeld at refractions.net
Mon Mar 10 12:51:16 PDT 2008


I concur, it sounds like you're after topology support in PostGIS.  
Regina's function will simply provide you with the raw lines that make 
up a polygon (the first half of Martin's first bullet item).  Topology 
in PostGIS is very much in a pre-alpha stage.  There is an underlying 
topology datamodel, but that's about it.  The stored procedures Martin 
was referring to has yet to be developed.
(see this thread 
http://postgis.refractions.net/pipermail/postgis-users/2007-October/017530.html)

Cheers,
Kevin

Martin Davis wrote:
> It sounds like what you are looking for is a way to turn a set of 
> non-overlapping polygons and turn them into a polygonal coverage (or 
> at least produce the arcs in that coverage).
>
> I don't think there's any easy way of doing this in PostGIS.  I'm not 
> sure that Regina's & Kevin's suggestions will produce the non-shared, 
> unique node-to-node arcs that are required.
>
> The usual algorithm for doing this is:
> - extract all line segments from each input polygon, labelled with the 
> polygon ID on the appropriate side
> - merge duplicate segments, also merging the labels (on the 
> appropriate side).  To identify duplicate segments and merge them, 
> segments will need to be reoriented so that they are in a consistent 
> direction (and the labels flipped accordingly)
> - "sew" the resulting set of line segments together to create 
> linestring edges from 3-node to 3-node  (e.g. eliminating 
> "non-topologically significant" 2-nodes
>
> You might be able to create some SQL and/or stored proc code to do 
> this - it would be interesting to see how complicated and performant 
> this would be.
>
> Lee Hachadoorian wrote:
>> I'm looking through the PostGIS reference, and I can't seem to find a 
>> way to take a geometry of polygons and turn it into lines.  What I'm 
>> looking for is something like the ArcGIS Feature to Line 
>> geoprocessor, which will create a line shapefile where each feature 
>> is an arc representing the boundary between neighboring polygons with 
>> a field indicating the ids of the polygon on either side.
>>
>> Functions like ST_MakeLine require point geometries, and I don't see 
>> anything else that seems to be what I'm looking for.  Any ideas would 
>> be welcome.
>>
>> Thanks,
>> Lee Hachadoorian
>> PhD Student in Geography
>> Program in Earth & Environmental Sciences
>> CUNY Graduate Center
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>



More information about the postgis-users mailing list