Bug report #20721
gdal:warpreproject missing old 'extra' param
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | Alexander Bruy | ||
Category: | Processing/GDAL | ||
Affected QGIS version: | 3.5(master) | Regression?: | Yes |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | Yes | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 28541 |
Description
This issue seems related to #20586.
In QGis 2.18 we were using "gdalogr:warpreproject" passing '-srcnodata {some_value} -dstalpha' as 'extra' param. The processing toolbox allowed setting it using the item 'Additional creation parameters'.
In our case, this 'extra' param was needed to correctly get the transparency on a given raster.
In QGis 3.4 and 3.5(master), this 'extra' argument is not available any more: nor in the dialog opened from the processing toolbox, nor in the arguments shown by processing.algorithmHelp("gdal:warpreproject")
So, with QGis 3 we have lost the availability to pass gdal the extra params -srcnodata and -dstalpha.
Dirty workaround¶
By the way, we have found and we are using a quite dirty trick to have gdal receive this -srcnodata and -dstalpha parameters. We pass 'options' set with a value such as this:
'COMPRESS=JPEG|JPEG_QUALITY=75|-dummyworkaround -srcnodata {} -dstalpha'
That, just by chance, seems that makes gdal receive a "-co -dummyworkaround" that is ignored, and then the -srcnodata and -dstalpha that we need...
04-12-2018 16:39:19 - gdalwarp -s_srs EPSG:32635 -t_srs EPSG:32635 -r near -ot Byte -of GTiff -co COMPRESS=JPEG -co JPEG_QUALITY=75 -co -dummyworkaround -srcnodata -9999.0 -dstalpha D:\users\jmperez\temp\newTpzLayer7offnjok\tmp_merged_via_virtual_raster.tif D:\users\jmperez\temp\newTpzFilemfoh41a0.tif 04-12-2018 16:39:19 - Warning 6: creation option '-dummyworkaround' is not formatted with the key=value format 04-12-2018 16:39:19 - Creating output file that is 269P x 177L. 04-12-2018 16:39:19 - Processing D:\users\jmperez\temp\newTpzLayer7offnjok\tmp_merged_via_virtual_raster.tif [1/1] : 0...10...20...30...40...50...60...70...80...90...Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn't match SamplesPerPixel. Defining non-color channels as ExtraSamples. 04-12-2018 16:39:19 - 100 - done.
Associated revisions
[processing] add optional EXTRA parameter to gdalwarp algorithm (fix #20721)
This allows users to pass additional command-line arguments which are
not exposed in the algorithm definition. The most frequent use case is
enabling transparency and adding nodata values.
[processing] add optional EXTRA parameter to gdalwarp algorithm (fix #20721)
This allows users to pass additional command-line arguments which are
not exposed in the algorithm definition. The most frequent use case is
enabling transparency and adding nodata values.
(cherry picked from commit bb2c3663b0033269b4720477a809b206d22cd899)
History
#1 Updated by Giovanni Manghi almost 6 years ago
- Category changed from GDAL Tools to Processing/GDAL
- Priority changed from Normal to High
- Assignee set to Giovanni Manghi
#2 Updated by Alexander Bruy almost 6 years ago
- Assignee changed from Giovanni Manghi to Alexander Bruy
- Pull Request or Patch supplied changed from No to Yes
#3 Updated by Alexander Bruy almost 6 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset qgis|bb2c3663b0033269b4720477a809b206d22cd899.
#4 Updated by Alexander Bruy almost 6 years ago
- Resolution set to fixed/implemented