[Gdal-dev] Change EXTENT of a shapefile

Frank Warmerdam warmerdam at pobox.com
Wed Apr 23 12:09:04 EDT 2008


shortyII wrote:
> Hi Frank
> thank you. Now I don't get an error, but it still doesn't work.
> The extent parameters have their old values. Is this a principal problem of
> shapefiles?

Stefan,

Note that the -spat switch does not set the spatial extent of the new
shapefile - that is established by the cumulative bounds of all features
written to it.  The -spat switch just requests only features which
intersect the indicated region should be transferred.  If, for instance,
you have a "universe polygon" in your source file, then it will impact
the area, and will be copied to the output file, and you will get the
same output file bounds.

That is to say, -spat will *not* clip feature geometries.

There is no mechanism through OGR (or Shapelib for that matter) to
directly set the spatial extents in the shapefile header.  It is always
computed as side effect of writing features.

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