[gdal-dev] Using -overwrite to create empty feature class

Even Rouault even.rouault at mines-paris.org
Wed Feb 1 16:38:01 EST 2012


Le mercredi 01 février 2012 22:22:42, Donovan Cameron a écrit :
> Afternoon List.
> 
> I am trying to generate an empty feature (shp or gml) from a template that
> retains both the attribute-table schema and map projection.
> 
> I can't get the *-overwrite *flag to work, it just copies the entire
> feature (ie, makes a duplicate):
> *ogr2ogr -overwrite -f "GML" geoname.gml /vsizip/vsicurl/
> ${inZIP}/${inGML}* *
> *
> The next commands <http://gis.stackexchange.com/a/16510/1297>[1] work using
> *-where *or *-fid*:
> *ogr2ogr -f "GML" geoname.gml /vsizip/vsicurl/ ${inZIP}/${inGML} -where
> "FID < 0"*
> *ogr2ogr -f "GML" geoname.gml /vsizip/vsicurl/ ${inZIP}/${inGML} -fid "<
> 0"*
> 
> I thought the* -overwrite* flag would delete the output layer and recreate
> it empty <http://www.gdal.org/ogr2ogr.html>[2]?

-overwrite deletes the output layer, so that the new features added by ogr2ogr 
aren't added to the previously existing one, but in no way it creates an empty 
layer.

The -where "fid < 0" trick is actually an interesting one. I've no better 
suggestion.


More information about the gdal-dev mailing list