[gdal-dev] GDAL overrite file error

Even Rouault even.rouault at spatialys.com
Fri Feb 6 02:06:36 PST 2015


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


More information about the gdal-dev mailing list