[postgis-users] How to convert multipolygon to linestring

Piotr Kania p.kania at op.pl
Tue Sep 22 15:14:08 PDT 2015


Hi!
I try to convert my multipolygon layer to multilinestring - here: 
http://postgis.refractions.net/docs/ST_ExteriorRing.html
I found example:
"(...)--If you have a table of MULTIPOLYGONs
--and want to return a MULTILINESTRING composed of the exterior rings of 
each polygon
SELECT gid, ST_Collect(ST_ExteriorRing(the_geom)) AS erings
     FROM (SELECT gid, (ST_Dump(the_geom)).geom As the_geom
             FROM sometable) As foo
GROUP BY gid;
(...)"

My postgresql connection calls -"database", schema-"public", default 
primary key field - "gid", default geometry field  -"geom", my 
multipolygon layer- "poly_layer". How will look sql code above, with my 
data- if I'd like to convert "poly_layer" into new multilinestring layer 
"line_layer"?

Thanks for response

Regarding

Piotr Kania



More information about the postgis-users mailing list