Database Reference
In-Depth Information
CREATE OR REPLACE FUNCTION
chp02.polygon_to_line(geometry)
RETURNS geometry AS
$BODY$
SELECT ST_MakeLine(geom) FROM (
SELECT (ST_DumpPoints(ST_ExteriorRing(
(ST_Dump($1)).geom
))).geom
) AS linpoints
$BODY$
LANGUAGE sql VOLATILE;
ALTER FUNCTION chp02.polygon_to_line(geometry)
OWNER TO me;
Nowthatwehavethe polygon_to_line function,westillneedtoforcethenoding
ofoverlappinglinesinourparticularuse.The ST_Union functionwillaidinthisas
shown in the following query:
SELECT ST_Union(geom) AS geom FROM (
SELECT chp02.polygon_to_line(geom) AS geom
FROM
chp02.use_area
) AS unioned
;
Converting linestrings back to polygons
Nowwecanpolygonizethisresultusing ST_Polygonize ,asshowninthefollowing
query:
SELECT ST_Polygonize(geom) AS geom FROM (
SELECT ST_Union(geom) AS geom FROM (
SELECT chp02.polygon_to_line(geom) AS geom
FROM
Search WWH ::




Custom Search