[gdal-dev] gdaldem in python doesnt recognise addAlpha = True

Corina Tudorache corina_ww at yahoo.com
Wed Feb 6 08:35:40 PST 2019


 Hi Even,
I am passing something like thisds = gdal.DEMProcessing('color-relief', file, outfile, options=[-alpha], colorFilename = 'data/file.txt')

But I get an error message too:NameError: name 'alpha' is not defined
The bash syntax would be:gdaldem color-relief file1.tif -alpha hramp.txt file2.tif

Thanks,Corina
    On Wednesday, 6 February 2019, 16:14:56 GMT, Even Rouault <even.rouault at spatialys.com> wrote:  
 
 On mercredi 6 février 2019 08:17:03 CET Corina Tudorache wrote:
> Hi list,
> 
> I have been trying to use gdaldem in python to set the background color to
> transparent. Unfortunately gdaldem doesnt recognise addAlpha = True, i get
> this error message:
> TypeError: DEMProcessingOptions() got an unexpected keyword argument
> 'addAlpha'
> 
> ds = gdal.DEMProcessing(infile, outfile, 'color-relief', format = 'MEM',
> colorFilename = '/data/file.txt', addAlpha = True)
> 
> Is there a way to fix this behaviour?

This was added in GDAL 2.3.0
As a workaround you can use the options= keyword and format its value with 
what you would put on the gdaldem command line

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190206/56cb7e75/attachment.html>


More information about the gdal-dev mailing list