[gdal-dev] Calculate footprints of shapefiles

Marius Jigmond mariusjigmond at hotmail.com
Tue Mar 15 20:35:59 EDT 2011


Armin,

Not sure if this would be straightforward in GDAL but you might want to
consider a combination of GDAL + Shapely
(http://gispython.org/shapely/docs/1.2/manual.html#cascading-unions).
What you're trying to do is spatial analysis not directly implemented in
GDAL. Shapely requires that you're working with Cartesian coordinates.
The upside is that it has WKT/WKB support for direct loading into
PostGIS.

-marius

On Wed, 2011-03-16 at 01:08 +0100, Armin Burger wrote: 
> 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
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 



More information about the gdal-dev mailing list