[postgis-users] Newbie - ST_Exterior, ST_Interior, ST_Polygonize
kneufeld at refractions.net
Mon Jun 30 14:55:40 PDT 2008
What are you trying to do exactly?
If you're after rebuilding a polygon from it's constituent linework,
then I suggest using ST_Boundary instead. ST_Boundary returns a
geometry with a dimension one less than the input geometry. So, for a
polygon (a dimension of 2), this returns the lines (a dimension of 1),
that define it's boundary (the exterior and interior rings).
If you need to node together the boundary lines so ST_Polygonize works
as you'd expect, try ST_Union with the startpoint of the lines.
You can use ST_Dump to explode/deaggregate a multipolygon into
Depending on what you're trying to do, your query might look something
-- convert multipolygon to polygon
SELECT (ST_Dump(polygonized)).geom AS the_geom
-- polygonize linework
SELECT ST_Polygonize(noded) AS polygonized
-- node linework together
SELECT ST_Union(bndy, ST_Startpoint(bndy))) AS noded
-- get the exterior and interior rings.
SELECT ST_Boundary(the_geom) AS bndy
) AS b
) AS n
) AS p
Keep in mind that ST_Polygonize will return all the polygons formed from
the input linework, including polygons for the holes. You could try
ST_BuildArea to automatically dissolve adjacent polygons together and
remove holes from the resultant polygon. Or you could create a point on
the surface of your resultant polygons (ST_PointOnSurface) and overlay
it with your original polygon to determine which is a hole and which is not.
Intengu Technologies wrote:
> How does one use the following functions ST_Exterior, ST_Interior,
> ST_Polygonize to work with a multipolygon (cadastre) that has islands
> (over 1000). I understand that ST_Exterior creates a polyline of the
> outside of the polygon and ST_Interior creates the inside of the
> polygon. You then use ST_Polygonize to recreate the multipolygon from
> Any assistance would help.
> Sindile Bidla
> postgis-users mailing list
> postgis-users at postgis.refractions.net
More information about the postgis-users