[postgis-users] remove polygon from multipolygon

Kevin Neufeld kneufeld at refractions.net
Fri Oct 24 12:20:26 PDT 2008


Yeah, it's a relatively newly discovered syntax that works very well.

http://postgis.refractions.net/documentation/manual-svn/ST_Dump.html

Cheers,
Kevin

Frank Durstewitz, Emporis GmbH wrote:
> Hi Kevin,
> 
> yes, that looks good. I was on that way, but could not figure out, how 
> to get the geometry out of the dump rows.
> Very nice this one, i have never seen this ".geom" (and still could not 
> find it somewhere in the docs?).
> Many thanks!
> 
> Kindly regards, Frank
> 
> Kevin Neufeld am 24.10.2008 20:44:
>> 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
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 
> _______________________________________________
> 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