[gdal-dev] ogrinfo: how retrieve the extent of a single geometry

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Sat Oct 5 12:20:03 PDT 2013


Andre Joost <andre+joost <at> nurfuerspam.de> writes:

> 
> Am 05.10.2013 08:11, schrieb Andrea Peri:
> > Hi all,
> >
> > I need to retrieve the extent of a single geometry using ogrinfo.
> >
> > I try to use this sintax:
> >
> > ogrinfo -al -so filename.shp -where "field1='value1'"
> >
> > But ogrinfo return always the extent of all the shapefile not only the
> > extent of filtered one.
> >
> 
> This will not work. See:
>
<http://osgeo-org.1560.x6.nabble.com/Re-Selecting-features-using-ogrinfo-td4538045.html>
> 
> last answer.

Use -dialect SQLITE and play a bit with the -sql parameter and I believe you
can construct a field that suits your needs. Here is a coarse example

ogrinfo -dialect sqlite -sql "select GEOMETRY,
MbrMinX(GEOMETRY),MbrMinY(GEOMETRY),MbrMaxX(GEOMETRY),MbrMaxY(GEOMETRY)from
test limit 1" test.shp

-Jukka Rahkonen-

> HTH,
> André Joost
> 






More information about the gdal-dev mailing list