Search code examples
c++gdal

Set OSM config options using API and not the global config file


When reading OSM files using GDAL, the fields that are read are defined in osmconf.ini, and if I want that certain tags don't appear within the other_tags then I need to add them to the attributes value in the corresponding sections.

This works fine, but is not really portable, so my questions is, is there a ways to define the settings saved in osmconf.ini in a portable way per project?


Solution

  • This is possible using the CPLSetConfigOption function, and store the config file in current working directory:

    CPLSetConfigOption("OSM_CONFIG_FILE", "osmconf.ini");