[gdal-dev] Calculate footprints of shapefiles

Armin Burger armin.burger at gmx.net
Tue Mar 15 20:08:48 EDT 2011


Hi all

I would like to catalogue shapefiles scattered over lots of directories 
of the file system and store retrievable information of the shapefiles 
in a PostGIS layer. Extracting parameters like extent, projection, 
fields, etc works very fine with GDAL's Python bindings.

But I would also like to store a sort of "footprint" of the whole 
shapefile as a geometry object since the extent is a bit coarse 
geographic representation of the shapefile.

So far I have no better idea than eg. for polygon shapefiles looping 
through all features, applying a Union function on them. And at the end 
trying to use the Simplify method on the resulting polygon that will be 
used as the footprint.

This is for sure not very efficient for larger shapefiles with lots of 
records. And for line and point shapefiles I still don't have a clue how 
their records could be represented by an enclosing polygon (maybe the 
Boundary functions does something like this...).

Any ideas how this footprint generation could be achieved in a feasible 
way using GDAL/OGR Python?

Cheers, Armin


More information about the gdal-dev mailing list