[Gdal-dev] aggregate polygons to multipolygons based on an
attribute column (shapefile)
Frank Warmerdam
fwarmerdam at gmail.com
Wed Jun 15 10:55:13 EDT 2005
On 6/15/05, Bart van den Eijnden <BEN at syncera-itsolutions.nl> wrote:
> Hi list,
>
> is there a tool in the OGR library to aggregate polygons to multipolygons based on an attribute column for shapefiles? Does anybody know how to go about this if it can't be done with OGR?
Bart,
You could write a python script (or C++ program) to accomplish
this with OGR but there is no built-in capability for this in OGR
command line utilities.
If I were to do it in Python I would read all the features, and maintain
an associative array of geometries in memory to accumulate the
multipolygons, with the attribute value being the key into the array.
This approach assumes that your dataset is small enough that all
the geometry could be held in memory.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list