Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Main Repositories
otb
Commits
d8abe8f8
Commit
d8abe8f8
authored
Jun 07, 2019
by
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
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx
View file @
d8abe8f8
...
...
@@ -828,9 +828,13 @@ 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
int
fIndex
=
ogrFeature
->
GetFieldIndex
(
key
);
if
(
fIndex
>=
0
)
ogrFeature
->
SetField
(
fIndex
,
kwl
.
GetFieldAsString
(
key
).
c_str
());
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());
...
...
@@ -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
(
fIndex
>=
0
)
ogrFeature
->
SetField
(
fIndex
,
kwl
.
GetFieldAsString
(
key
).
c_str
());
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,7 +1194,12 @@ 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
ogrFeature
->
SetField
(
ogrFeature
->
GetFieldIndex
(
key
)
,
kwl
.
GetFieldAsString
(
key
).
c_str
());
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
);
...
...
@@ -1259,8 +1270,11 @@ 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
ogrFeature
->
SetField
(
ogrFeature
->
GetFieldIndex
(
key
)
,
kwl
.
GetFieldAsString
(
key
).
c_str
());
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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment