[postgis-users] merge geometries

Paul Ramsey pramsey at refractions.net
Sun Aug 31 13:58:18 PDT 2003


Now that we have GEOS functionality, we can bind the geomunion (man I 
hate that namespace hack (stupid spec writers)) into an aggregate 
function which does what you want. It will be necessarily slow (each 
union will be done separately and serially) but it should provide the 
kind of result people are looking for:

select geomunion(the_geom),tract_number from census data group by 
tract_number

Would return one polygon (assuming spatial adjacency) for each 
tract_number.

Paul

On Sunday, August 31, 2003, at 12:35 PM, Heitzso wrote:

> I've used 'collect(the_geom) as the_geom'
> as an aggregate function, but it doesn't pull out
> the internal pieces.  Context was wanting to
> aggregate census block into census tract.  What
> I'm left with is a polygon with lots of internal
> line segments within the census tract that correspond
> to the census block boundaries.
>
>
> Chris Faulkner wrote:
>> Hello
>> Is there any way to merge geometries using one of the functions in 
>> postgis.
>> If I have a table with 2 fields, ID and GEOMETRY. I have a list of 
>> ids and
>> would like to combine all the geometries in those ids.
>> select combine(GEOMETRY) from table where id in (1,2,3);
>> I expect that the function would return a type of MULTILINE, 
>> MULTIPOLYGON
>> and so on.
>> I can see a function geometry_union but this expects two parameters, 
>> two
>> geometries. My requirement is slightly different, or is there anyway 
>> of
>> using this to achieve what I want ?
>> Thanks
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
      Paul Ramsey
      Refractions Research
      Email: pramsey at refractions.net
      Phone: (250) 885-0632




More information about the postgis-users mailing list