Skip to content

Fix error : Invalid index -1

Cédric Traizet requested to merge fix_invalid_index into develop

Summary

Sometimes otb logs the following error from gdal:

ERROR 1: Invalid index : -1

This happens for example on the test bfTvVectorDataRasterizeFilterSHP. This MR adds a fix for this bug.

See related issue #1883 (closed)

Rationale

In otbOGRIOHelper the ConvertDataTreeNodeToOGRLayers creates a memory ogr layer from vector data. All fields from the VectorDataKeyworkList are created in the layer except from FID. Then, the vector data is added to the layer. For points geomtries, all fields are copied excepting the FID field, but for other geometries (lines and polygons) all fields are copied, including the FID. As this has not been created, its field index is -1, and the field cannot be copied.

With this MR the FID field is not copied anymore (same behavior for points, lines and polygons)

This also applies to the ProcessNodeWrite() method.

Copyright

The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.


Check before merging:

  • All discussions are resolved
  • At least 2 👍 votes from core developers, no 👎 vote.
  • The feature branch is (reasonably) up-to-date with the base branch
  • Dashboard is green
  • Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
  • Optionally, run git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i on latest changes and commit
Edited by Cédric Traizet

Merge request reports

Loading