qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.52k stars 2.99k forks source link

Add NODATA support to Raster Calculator #47812

Closed ColinMaz closed 10 months ago

ColinMaz commented 2 years ago

What is the bug or the crash?

I am using the new Raster Calculator (accessed from the Raster menu) to calculate the difference between two rasters (QGIS 3.22). This works but a no data value is not assigned to the output raster. Instead the usual no data value (-3.40282e+38) appears incorrectly in the symbology window when I classify the data. If I use the QGIS Raster Calculator in the Processing toolbox, the no data value (as above) is correctly assigned.

I have managed in the past to fix my issue by using the r.null tool but this shouldnt be needed.

As a side note, it is a bit confusing to have two QGIS raster calculators, (beside the GDAL and SAGA ones). Perhaps some thought could be given as to how best the two can be distinguished from each other.

Steps to reproduce the issue

1 Raster (menu) select Raster Calculator 2 Subtract one elevation raster from another (e.g. A- B) - see screen shot. Both input rasters had no data values assigned to them (-99999 and -3.40282e+38 respectively). They are both in the same CRS, same pixel size and both Float32. 3 View the output. Note No Data value not assigned. Instead the standard no data value appears incorrectly as a minimum data value as shown below. image

Correct behaviour should be something like this: image

Versions

QGIS version 3.22.1-Białowieża QGIS code revision 663dcf8fb9 Qt version 5.15.2 Python version 3.9.5 GDAL/OGR version 3.4.0 PROJ version 8.2.0 EPSG Registry database version v10.038 (2021-10-21) GEOS version 3.10.0-CAPI-1.16.0 SQLite version 3.35.2 PDAL version 2.3.0 PostgreSQL client version 13.0 SpatiaLite version 5.0.1 QWT version 6.1.3 QScintilla2 version 2.11.5 OS version Windows 10 Version 2009

Active Python plugins kmltools 3.1.16 profiletool 4.2.2 ProjectPackager 0.5.1 qgis_resource_sharing 0.16.0 slyr 3.18.0 SpreadsheetLayers 2.0.1 db_manager 0.1.20 grassprovider 2.12.99 MetaSearch 0.3.5 processing 2.12.99 sagaprovider 2.12.99

Supported QGIS version

New profile

Additional context

This has happened on two different computers. I hope I have provided enough info. Very grateful for any help in solving this.

mikedufty commented 1 year ago

I'm finding this a constant frustration too. Seems to be particularly an issue with float32 raster results.

alexbruy commented 1 year ago

I'd say this is more a feature request than bug.

alexbruy commented 10 months ago

Duplicates #44571.