Skip to content

Inconsistent behaviour of geom file loading

Description

If the user has an image file (image.tif) with a geom file (image.geom), the following behaviour are inconsistent :

Read image.tif

-> in this case the code ends in https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/blob/develop/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx#L224

This method instanciate a sensor model through the factories, and then export back to keywordlist. As a consequence, any additional information that has not been parsed by the factory-selected sensor model is wiped out.

Read image.tif?&geom=image.geom

-> in this case the code ends in https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/blob/develop/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx#L379

The geom file is loaded into ImageKeywordlist "as is", without trying to instantiate any sensor model.

Steps to reproduce

Write an additional tag in the geom file, then use ReadImageInfo with either image.tif or Read image.tif?&geom=image.geom

Configuration information

All versions and os affected

Possible fix

There is no reason why we should filter keywordlist based on sensor model factory at reading time. Only when we need to actually use sensor modelling should we go through the factory. So my recommandation would be to change the code so that if a geom file with same name is present OR if it is set with the extended filename option, then we go through ReadGeometryFromGEOMFile and read the keywordlist 'as is'.