[postgis-users] getting different geometries with geomunion()

Nicolas Ribot nicky666 at gmail.com
Thu Jul 13 03:09:38 PDT 2006


> Hi everyone,
>
> can't find a solution in the archive, but maybe somebody asked this before:
>
> With GeomUnion postgis returns one single geometry. In my case the returned
> geometry is a multipolygon containing multiple geometries which don't
> adjoin. Is it possible to get one polygon for each area? Unfortunately there
> is no attribute to group by. The only attribute is the geometry, but I can't
> use the aggregated the_geom in the GROUP BY clause.
>
> For example, if you have a polygon database of all states of the US and your
> statement is this:
>
> SELECT geomunion(the_geom)
> FROM states
> WHERE name like 'I%'
>
> the result would be *one* multipolygon containing Illinois and Indiana, but
> also Idaho. How can you get seperated polygons containing only the
> respectively adjacent geometries?
>
> thanks and greetings
>

Hi,
What about using dump(geometry) as shown in a previsou thread: "Select
largest polygon of a multipolygon ?".
It will explode multipolygons into single parts.

Nicolas



More information about the postgis-users mailing list