[gdal-dev] Calculate footprints of shapefiles
Chaitanya kumar CH
chaitanya.ch at gmail.com
Wed Mar 16 00:36:57 EDT 2011
Armin,
This can be done in either OGR or PostGIS.
For OGR, refer to the OGRGeometry class reference, especially the
ConvexHull(), Union() and UnionCascaded() functions.
For PostGIS, ST_Boundary() and ST_Union().
On Wed, Mar 16, 2011 at 6:23 AM, Armin Burger <armin.burger at gmx.net> wrote:
> Marius,
>
> thanks for the suggestion. I don't know if shapely supports re-projection
> of geometries or has a simplify algorithm, which I will both need. There
> could be some other functions of GDAL/OGR that I might need in the future as
> well. So in principal I'd prefer to stick to GDAL.
>
> armin
>
>
> On 16/03/2011 01:35, Marius Jigmond wrote:
>
>> 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
>>>
>>>
>>
>> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
--
Best regards,
Chaitanya kumar CH.
/tʃaɪθənjə/ /kʊmɑr/
+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110316/1a880c10/attachment.html
More information about the gdal-dev
mailing list