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

Raster layer unique values report returning area values in deg2 #58685

Closed scabecks closed 1 month ago

scabecks commented 1 month ago

What is the bug or the crash?

The outputs of the Raster layer unique values report tool are reporting values in deg2 for rasters in EPSG:4326 (pixel resolution is ~1km). image

Projected versions of the same raster (for example to Mollweide) will return values in m².

image

The documentation notes outputs m2: total area in square meters of pixels with this value and the tool outputs used to return values in m2 regardless of CRS. Is this a new behaviour? The fact the value is being returned as deg2 suggests that maybe it is not?

Steps to reproduce the issue

Open a raster with an EPSG:4326 CRS

Click on Raster layer unique values report. Select that raster as Input layer. Click Run

Open the output html file from the Results Viewer

image

Versions

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

QGIS version | 3.38.2-Grenoble | QGIS code branch | Release 3.38 -- | -- | -- | -- Qt version | 5.15.10 Python version | 3.11.9 GDAL/OGR version | 3.9.2 PROJ version | 9.4.1 EPSG Registry database version | v11.006 (2024-03-13) GEOS version | 3.13.0-CAPI-1.19.0 SQLite version | 3.44.2 PDAL version | 2.8.0 PostgreSQL client version | unknown SpatiaLite version | 5.0.1 QWT version | 6.1.5 QScintilla2 version | 2.14.1 OS version | KDE Flatpak runtime   |   |   |   Active Python plugins RasterAttributeTable | 1.2 IPyConsole | version 2.0 quick_map_services | 0.19.34 valuetool | 3.0.19 SpreadsheetLayers | 2.1.2 DigitizingTools | 1.5.2 processing | 2.12.99 grassprovider | 2.12.99 db_manager | 0.1.20 QGIS version 3.38.2-Grenoble QGIS code branch [Release 3.38](https://github.com/qgis/QGIS/tree/release-3_38) Qt version 5.15.10 Python version 3.11.9 GDAL/OGR version 3.9.2 PROJ version 9.4.1 EPSG Registry database version v11.006 (2024-03-13) GEOS version 3.13.0-CAPI-1.19.0 SQLite version 3.44.2 PDAL version 2.8.0 PostgreSQL client version unknown SpatiaLite version 5.0.1 QWT version 6.1.5 QScintilla2 version 2.14.1 OS version KDE Flatpak runtime Active Python plugins RasterAttributeTable 1.2 IPyConsole version 2.0 quick_map_services 0.19.34 valuetool 3.0.19 SpreadsheetLayers 2.1.2 DigitizingTools 1.5.2 processing 2.12.99 grassprovider 2.12.99 db_manager 0.1.20 ### Supported QGIS version - [X] I'm running a supported QGIS version according to [the roadmap](https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule). ### New profile - [X] I tried with a new [QGIS profile](https://docs.qgis.org/latest/en/docs/user_manual/introduction/qgis_configuration.html#working-with-user-profiles) ### Additional context _No response_
agiudiceandrea commented 1 month ago

@scabecks, the distance measure unit of CRS EPSG:4326 and the pixel resolution unit for a raster in such CRS is the deg .

AFAIK, the processing algorithm "Raster layer unique values report" (native:rasterlayeruniquevaluesreport) always (since QGIS 3.0) reported the area in the area unit of the layer's CRS, which is deg² for a CRS with distance measure unit of deg.

May you please indicate the QGIS version in which the behavior was different?

Anyway, the algorithm's documentation seems incorrect and should be amended.

scabecks commented 1 month ago

Thanks @agiudiceandrea. It has been a while since I'd last used and thought I'd seen m² outputs from the Raster layer unique values report tool, so I am perhaps simply mixing up outputs from grass's r.stats (with the -a flag) (and cannot remember what QGIS version I thought this behaviour was occurring). I wouldn't put it past me...

If that is indeed the case, and the expected/intended behaviour is indeed to not calculate and report areas in m² even where the CRS unit is degrees, perhaps then this ticket should move to updating the documentation which notes (with no mention of output units being the same as CRS units): image

agiudiceandrea commented 1 month ago

I think this is a documentation issue. See https://github.com/qgis/QGIS-Documentation/pull/9257.