[postgis-users] remove polygon from multipolygon
Kevin Neufeld
kneufeld at refractions.net
Fri Oct 24 11:44:06 PDT 2008
What about something like this:
SELECT ST_Collect(geom)
FROM (
SELECT (ST_Dump(geom)).geom
FROM my_multi_polygon_table) AS foo
WHERE ST_Y(ST_Centroid(geom)) <= 0;
Explode the multipolygon into individual polygons using ST_Dump, and
ST_Collect the ones back up again where the centroid falls within some
specification.
-- Kevin
Frank Durstewitz wrote:
> Hello list,
>
> i must remove from multipolygon some polygons, for example remove all
> polygons from "russia", where latitude of centroid of polygon is <= 0
> (in this case the part of russia which is near alaska).
>
> I think this should be possible (ST_Dump...), but i cannot find any way
> to do so.
> Deleting the vertices by hand via a desktop gis is painfull slow and
> will take ages - i tried this and need ~ 5 minutes for a very small
> island of ~ 20 points... (i found no desktop gis where i can select
> multiple vertices by a bounding box and delete them at once).
>
> Thanks,
>
> Frank
>
> ST_Summarize gives
>
> MultiPolygon[BS] with 1393 elements
> Polygon[] with 1 rings
> ring 0 has 15 points
> ...
> Polygon[] with 1 rings
> ring 0 has 25 points
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list