Commit d8abe8f8 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

BUG: do not set FID field as it hasn't been created

parent 38e4e896
Pipeline #1715 passed with stages
in 43 minutes and 4 seconds
......@@ -828,10 +828,14 @@ unsigned int OGRIOHelper
// Get the key of the Nth OGRFieldRefn
const char * key = kwl.GetNthField(i).first->GetNameRef();
// Edit the value of the field and add it to the current feature
if (std::string(key) != "FID")
{
int fIndex = ogrFeature->GetFieldIndex(key);
if (fIndex >= 0)
ogrFeature->SetField(fIndex , kwl.GetFieldAsString(key).c_str());
}
}
// ogrFeature->SetField("Name", dataNode->GetNodeId());
ogrFeature->SetGeometry(&ogrLine);
......@@ -916,10 +920,13 @@ unsigned int OGRIOHelper
const char * key = kwl.GetNthField(i).first->GetNameRef();
// Edit the value of the field and add it to the current feature
int fIndex = ogrFeature->GetFieldIndex(key);
if (std::string(key) != "FID")
{
if (fIndex >= 0)
ogrFeature->SetField(fIndex , kwl.GetFieldAsString(key).c_str());
}
}
ogrFeature->SetGeometry(ogrPolygon);
if (ogrCurrentLayer->CreateFeature(ogrFeature) != OGRERR_NONE)
......@@ -1049,7 +1056,6 @@ std::vector<OGRLayer*> OGRIOHelper
GDT_Unknown,
0);
}
std::vector<OGRLayer*> ogrLayerVector;
//unsigned int kept = 0;
bool fieldsAddedToOGRLayer = false;
......@@ -1188,8 +1194,13 @@ std::vector<OGRLayer*> OGRIOHelper
// Get the key of the Nth OGRFieldRefn
const char * key = kwl.GetNthField(i).first->GetNameRef();
// Edit the value of the field and add it to the current feature
if (std::string(key) != "FID")
{
// Edit the value of the field and add it to the current feature
ogrFeature->SetField(ogrFeature->GetFieldIndex(key) , kwl.GetFieldAsString(key).c_str());
}
}
ogrFeature->SetGeometry(&ogrLine);
if (ogrCurrentLayer->CreateFeature(ogrFeature) != OGRERR_NONE)
......@@ -1259,9 +1270,12 @@ std::vector<OGRLayer*> OGRIOHelper
{
// Get the key of the Nth OGRFieldRefn
const char * key = kwl.GetNthField(i).first->GetNameRef();
if (std::string(key) != "FID")
{
// Edit the value of the field and add it to the current feature
ogrFeature->SetField(ogrFeature->GetFieldIndex(key) , kwl.GetFieldAsString(key).c_str());
}
}
ogrFeature->SetGeometry(ogrPolygon);
......
Supports Markdown
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