Re: [gdal-dev] Extract Extent or Bounding Box for a subset of shapes for a shapefile

2011-04-22 Thread Marius Jigmond
Luca, You can also loop through the features with relatively simple Python code to get the extents. See sample below (adapt at will): def findPoints(geometry, results): for i in range(geometry.GetPointCount()): x,y,z = geometry.GetPoint(i) if results['north'] == None or results['north']

Re: [gdal-dev] Extract Extent or Bounding Box for a subset of shapes for a shapefile

2011-04-22 Thread Luca Sigfrido Percich
Thank you Chaitanya. I think that this makes great sense when dealing with a summary of the whole layer, especially because a lot of formats store the extent in the layer metadata/header. But if I need to dump all the features, or to get a dump or summary of a filtered set of features (in which c

Re: [gdal-dev] Extract Extent or Bounding Box for a subset of shapes for a shapefile

2011-04-22 Thread Chaitanya kumar CH
Sig, ogrinfo doesn't force the recomputation of extent. It is considered as a costly operation. ogrinfo just reports the stored extent. Whereas in ogr2ogr, creating a new file automatically computes the extents. On Fri, Apr 22, 2011 at 7:44 PM, Luca Sigfrido Percich wrote: > > Hi Matthew, > > Yo

Re: [gdal-dev] Extract Extent or Bounding Box for a subset of shapes for a shapefile

2011-04-22 Thread Luca Sigfrido Percich
Hi Matthew, Your question is interesting. ogrinfo -where seemed to be the answer, but... I tried ogrinfo with the -where "sql where" option with both MapInfo and PostGIS layers. In your case it should be: ogrinfo -ro -so -al -where "$WHERECLAUSE" "whole_shapefile.shp" The returned extent is al

[gdal-dev] Extract Extent or Bounding Box for a subset of shapes for a shapefile

2011-04-22 Thread Matthew Pettis
Hi All, I think this is the right list for the question below, as I cannot find a different list that matches my question better. I'm using ogr2ogr and ogrinfo (v1.4), and I want to extract the extent from the result of a subsetting where argument. I have a solution here that works but I'm wonde