[Gdal-dev] ogr2ogr using -spat parameters

Frank Warmerdam warmerdam at pobox.com
Mon Feb 12 16:16:49 EST 2007


Gennady Khokhorin wrote:
> Hello, All.
> Playing with ogr2ogr utility found that -spat parameters (spatial query extents)
> are not a clipping window. At least for shp data format it will bring to output whole
> item crossing this window. Is it by design?

Gennady,

Yes, that is by design.

> Is there any clipping features in OGR lib like as in image gdal_translate.exe?

The OGRGeometry has an Intersection() method (not to be mistaken for
Intersects()) that will compute the intersection of two geometries.
So if you give it a window rectangle it will clip the geometry to that
rectangle.

This is only available when the build includes GEOS.  It is accessable from
the C, C++ and SWIG generated APIs.

There is no way to use this from the existing commandline tools unfortunately.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list