Commit a2d6cf59 authored by Julien Malik's avatar Julien Malik

BUG: in UpdateLayer mode, don't create field if it does not exists

parent a0048997
......@@ -491,9 +491,15 @@ private:
layer = ogrDS->CreateLayer(GetParameterString("mode.vector.layername"),
&oSRS,wkbMultiPolygon,
options);
// And create the field
OGRFieldDefn field(this->GetParameterString("mode.vector.fieldname").c_str(),OFTInteger);
layer.CreateField(field,true);
// And create the field if necessary
std::string fieldName = this->GetParameterString("mode.vector.fieldname");
OGRFeatureDefn & ogrFeatureDfn = layer.GetLayerDefn();
if (-1 != ogrFeatureDfn.GetFieldIndex(fieldName.c_str()))
{
OGRFieldDefn field(fieldName.c_str(),OFTInteger);
layer.CreateField(field,true);
}
}
else if(outmode == "ulco")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment