[gdal-dev] GDAL overrite file error
Stefan Keller
sfkeller at gmail.com
Thu May 7 11:27:03 PDT 2015
Hi,
Regarding overwrite:
I think the "-overwrite" parameter in ogr2ogr commandline tool does not work.
I tried it with drivers like "ESRI Shapefile", GeoJSON and others
without success.
ogr2ogr always exits and reports
"ERROR 6: The GeoJSON driver does not overwrite existing files."
Why should drivers not be able to overwrite?
Is'nt deleting files common task for all drivers (meaning to be
handled outside the actual writer drivers)?
-S.
2015-02-06 11:06 GMT+01:00 Even Rouault <even.rouault at spatialys.com>:
> Le vendredi 06 février 2015 10:42:04, Carlos Piury a écrit :
>> Hi, I am trying to create a vector format (i.e. ESRI Shapefile) from laser
>> file (.las), and it works fine, but when I try to overwrite the file I get
>> the following error:
>>
>> ERROR 1: Layer 'output' already exists
>
> --> The message is hopefully clear enough and comes from the implementation of
> CreateLayer() in the shape file driver. You have to destroy the files of the
> shapefile first if they exists. You can use DeleteDataSource() for that.
>
>> terminate called after throwing an instance of 'std::runtime_error'
>> what(): output layer creation failed
>> Aborted (core dumped)
>
> Does this come from inside GDAL code or you own code ? Looks like from yours,
> if you transform GDAL errors into C++ exceptions.
>
>>
>> I am using the next code to create the layer:
>>
>> OGRSFDriverH formatTranslateDriver =
>> OGRGetDriverByName(argFormat->sval[0]);
>>
>> OGRDataSourceH dataset = OGR_Dr_CreateDataSource(formatTranslateDriver,
>> argOutput->sval[0], 0);
>>
>> OGRLayerH layer = OGR_DS_CreateLayer(dataset, layerName.c_str(), 0,
>> wkbPoint25D, 0);
>>
>> Any idea about this error?
>>
>> Thanks.
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list