Sig,<br><br>ogrinfo doesn't force the recomputation of extent. It is considered as a costly operation. ogrinfo just reports the stored extent.<br>Whereas in ogr2ogr, creating a new file automatically computes the extents.<br>
<br><div class="gmail_quote">On Fri, Apr 22, 2011 at 7:44 PM, Luca Sigfrido Percich <span dir="ltr"><<a href="mailto:sigfrido@tiscali.it">sigfrido@tiscali.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Hi Matthew,<br>
<br>
Your question is interesting. ogrinfo -where seemed to be the answer,<br>
but...<br>
<br>
I tried ogrinfo with the -where "sql where" option with both MapInfo and<br>
PostGIS layers. In your case it should be:<br>
<br>
ogrinfo -ro -so -al -where "$WHERECLAUSE" "whole_shapefile.shp"<br>
<br>
The returned extent is always the same, regardless of the presence or<br>
composition of the -where clause, so it refers to the whole layer rather<br>
than to the selected features.<br>
(I'm using GDAL 1.9 dev)<br>
<br>
Is this the expected behaviour of ogrinfo -where "..."? Or sould -where<br>
affect the returned Extent too?<br>
<br>
Thank you all<br>
<br>
Sig<br>
<br>
Il giorno ven, 22/04/2011 alle 08.22 -0500, Matthew Pettis ha scritto:<br>
<div><div></div><div class="h5">> Hi All,<br>
><br>
><br>
> I think this is the right list for the question below, as I cannot<br>
> find a different list that matches my question better.<br>
><br>
><br>
> I'm using ogr2ogr and ogrinfo (v1.4), and I want to extract the extent<br>
> from the result of a subsetting where argument. I have a solution<br>
> here that works but I'm wondering if I'm missing some more obvious<br>
> solution. In a bash script, I do the following (the core snippet<br>
> only, as I took out the shebang and option-getting/setting code:)<br>
><br>
><br>
> ---------------------------<br>
> rm -rf /tmp/tmpshpfile.*<br>
><br>
><br>
> ogr2ogr -where "$WHERECLAUSE" /tmp/tmpshpfile.shp "$FILE"<br>
><br>
><br>
> ogrinfo -ro -so -al /tmp/tmpshpfile.shp | \<br>
> grep Extent | \<br>
> tr -d '[:alpha:]:() -' | \<br>
> tr ',' ' '<br>
><br>
><br>
> rm -rf /tmp/tmpshpfile.*<br>
> ---------------------------<br>
><br>
><br>
> I can use it as follows:<br>
><br>
><br>
> ---------------------------<br>
> $ ./bbox.sh -f /path/to/shp/shp_counties.shp -w "COUNTY_NAME='Yellow<br>
> Medicine'"<br>
> 226206.484375 4934737.000000313007.250000 4979500.500000<br>
> ---------------------------<br>
><br>
><br>
> Where the argument to '-w' is put into the '$WHERECLAUSE' variable in<br>
> the script.<br>
><br>
><br>
> This works. As I wrote, though, am I missing something obvious in<br>
> command-line switches to either of these programs that would simplify<br>
> this so I wouldn't have to use this script? Or is there some other,<br>
> better way of doing this? Also, is there a way to pipe the output of<br>
> ogr2ogr on stdout directly to the stdin of ogrinfo?<br>
><br>
><br>
> Thanks,<br>
> Matt<br>
</div></div>> _______________________________________________<br>
> gdal-dev mailing list<br>
> <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>/tʃaɪθənjə/ /kʊmɑr/ <br>+91-9494447584<br>17.2416N 80.1426E<br>