I am attempting to invoke the "SetConfigOption" function using the GDAL API to tweak GDAL's default settings to get additional information about GeoTiff. I am specifying the Config Options below in conjunction with the 'gdalinfo' command to retrieve information about the vertical coordinate reference system (VERTCRS). Running 'gdalinfo' on the GeoTiff as it is does not show the VERTCRS information, but the VERTCRS info. can obtained from the command line by typing/entering these Config Option commands individually before calling 'gdalinfo' on the GeoTiff.

Is there a way to use the "subprocess" function to seamlessly get the VERTCRS information?

Below is the code I am using, which prints the 'gdalinfo' output but does not capture the VERTCRS information as needed.

from osgeo import gdal, osr, ogr
import subprocess

gdal.SetConfigOption('DTED_APPLY_PIXEL_IS_POINT', 'TRUE')
gdal.SetConfigOption('GTIFF_POINT_GEO_IGNORE', 'TRUE')

cmd='gdalinfo C:\\users\\mikel\\GeoData\\DSM.tif'
  • 1
    You are mixing the GDAL API and a subprocess, those are two orthogonal approaches. Commented Nov 2, 2020 at 21:06
  • bugmenot123 - Thank you for your feedback. I am still confused then, shouldn't I still be able to retrieve the VERTCRS from another API function/command after specifying these config options? For some reason it seems to not retain these specs, perhaps it is a minor code tweak I am missing?
    – mdl518
    Commented Nov 2, 2020 at 21:14
  • print(gdal.Info('your/raster.tif')) use the API not the commandline.
    – user2856
    Commented Nov 2, 2020 at 21:41
  • @user2856 - I tried this command on my .tif, but I still get the same result. Is it a minor syntax error I may be missing when invoking the GDAL API config settings? Thanks again!
    – mdl518
    Commented Nov 2, 2020 at 22:22

2 Answers 2


Use the API rather than starting up a subprocess:

gdal.SetConfigOption('GTIFF_REPORT_COMPD_CS', 'YES')

Works for me with my data.

  • Thanks for the syntax tweak, this now works on my data as well! I was observing some inconsistencies amongst different data I was working with, but this is likely nuances to the individual files. I'll confirm your answer as the correct solution, most appreciated!
    – mdl518
    Commented Nov 2, 2020 at 23:11

According to the docs, you can use --config to set runtime config options on the command line, e.g.

gdal_translate --config GDAL_CACHEMAX 64 in.tif out.tif


  • mikewatt - Thank you for your feedback. So does this mean I can do something like "gdal_translate --config GTIFF_POINT_GEO_IGNORE=TRUE GTIFF_REPORT_COMPD_CS = TRUE <input.tif> <output.tif>"? The "GTIFF_REPORT_COMPD_CS" config option is set to TRUE to avoid stripping the VERTCRS when reading the SRS of the file, but I'm getting tripped up on the syntax - Thanks again!
    – mdl518
    Commented Nov 2, 2020 at 21:26
  • 2
    @mdl518 No. If you have multiple config options to set, you need to use multiple --config parameters, gdal_translate --config GTIFF_POINT_GEO_IGNORE TRUE --config GTIFF_REPORT_COMPD_CS TRUE etc...
    – user2856
    Commented Nov 2, 2020 at 21:40
  • @mikewatt - Thank you for clarifying. I think we are getting closer, but I want to avoid having to re-write a new GeoTiff file if possible just to invoke this config settings..."gdal_translate --config GTIFF_POINT_GEO_IGNORE TRUE <input.tif> <output.tif> creates a new GeoTiff that is 3x the size of the input. Is an output file also necessary for gdal_translate, or is there a more simple approach?
    – mdl518
    Commented Nov 2, 2020 at 21:51
  • 1
    You don't have to use gdal_translate the config options are applicable to any gdal commandline tool.
    – user2856
    Commented Nov 2, 2020 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.