[postgis-users] Split a polygon to N linestrings

Nicolas Gillet - MARKET-IP nicolas.gillet at market-ip.com
Fri Jan 29 05:16:35 PST 2010


Hello,

 

I am looking for some tips to split a polygon to its simplest linestrings.

An example worth better than words :

 

POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))

Would become :

MULTINLINESTRING((0 0, 0 1), (0 1, 1 1), (1 1, 1 0), (1 0, 0 0))

 

Every single linestring has to have two and only two points.

 

Is there a way to do this with the existing postgis functions ?

I found several ways to turn a polygon to a (multi)linestring but not to
split it then into shortest linestrings. 

 

Thanks for any input.

 

Nicolas

Gillet

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100129/fd7e5782/attachment.html>


More information about the postgis-users mailing list