Hi All,
<div><br></div><div>I think this is the right list for the question below, as I cannot find a different list that matches my question better.</div><div><br></div><div>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 wondering if I'm missing some more obvious solution. In a bash script, I do the following (the core snippet only, as I took out the shebang and option-getting/setting code:)</div>
<div><br></div><div>---------------------------</div><div><div>rm -rf /tmp/tmpshpfile.*</div><div><br></div><div>ogr2ogr -where "$WHERECLAUSE" /tmp/tmpshpfile.shp "$FILE"</div><div><br></div><div>ogrinfo -ro -so -al /tmp/tmpshpfile.shp | \</div>
<div> grep Extent | \</div><div> tr -d '[:alpha:]:() -' | \</div><div> tr ',' ' '</div><div><br></div><div>rm -rf /tmp/tmpshpfile.*</div></div><div>---------------------------</div><div><br>
</div><div>I can use it as follows:</div><div><br></div><div><div>---------------------------</div><div>$ ./bbox.sh -f /path/to/shp/shp_counties.shp -w "COUNTY_NAME='Yellow Medicine'"</div><div>226206.484375 4934737.000000313007.250000 4979500.500000</div>
</div><div><div>---------------------------</div></div><div><br></div><div>Where the argument to '-w' is put into the '$WHERECLAUSE' variable in the script.</div><div><br></div><div>This works. As I wrote, though, am I missing something obvious in command-line switches to either of these programs that would simplify this so I wouldn't have to use this script? Or is there some other, better way of doing this? Also, is there a way to pipe the output of ogr2ogr on stdout directly to the stdin of ogrinfo?</div>
<div><br></div><div>Thanks,<br>Matt</div>