[postgis-users] Turn a Polygon into Lines

Obe, Regina robe.dnd at cityofboston.gov
Mon Mar 10 04:51:32 PDT 2008


Take a look at the PostGIS wiki function fnpoly_to_rings and see if it
does something like what you are looking for.

http://postgis.refractions.net/support/wiki/index.php?plpgsqlfunctions 

You might need to modify it slightly to create single lines and then the
polygon id of left and right since it maintains the number of records
simply by turning the MULTIPOLYGON into MULTILINESTRINGS which would
require leaving out the ST_Collect  step and then doing an SQL update
after the fact based on equality of line geometries.

Only caveate - as some people have mentioned (generate_series degrades
for large numbers - I haven't had big enough geometries to run into the
issue)  .

Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Lee
Hachadoorian
Sent: Monday, March 10, 2008 1:21 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Turn a Polygon into Lines

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
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.




More information about the postgis-users mailing list