I am trying to color a GeoTIFF file and convert it to PNG. Several thread (1, 2) have pointed the gdaldem function. Here I am now porting the function to Python. Using the documentation, I can pass DEMProcessingOptions to DEMProcessing.
How do I pass the DEMProcessingOptions object to DEMProcessing correctly? I have this on my code:
from osgeo import gdal
src_ds = gdal.Open('./example.tif')
options = gdal.DEMProcessingOptions(colorFilename='./color_ramp.txt', format='PNG')
ds = gdal.DEMProcessing('./example_converted.png', src_ds, processing='color-relief', options)
I get the error:
Cell In [7], line 3 ds = gdal.DEMProcessing('./example_converted.png', src_ds, processing='color-relief', options) ^ SyntaxError: positional argument follows keyword argument
If I remove the variable names in the function:
ds = gdal.DEMProcessing('./example_converted.png', src_ds, 'color-relief', options)
It would error:
TypeError: DEMProcessing() takes 3 positional arguments but 4 were given