[gdal-dev] How to locate where the raster min and max values are?

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Tue Nov 5 03:09:35 PST 2024


Hi,

Very nice, seems that you both took the challenge very seriously. Now an advanced use case came into my mind, and it is about finding extreme values of sensor data within a polygon. Brute force method is to pre-process the raster and burn nodata into the exterior of the study area with gdal_rasterize by using the -i (invert) option. Can you suggest something more clever?

Right now I am just curious, but I guess that the QGIS Zonal statistics tool min/max option with additional x and y coordinate fields could make some users happy, or “gdal_minmax_location.py” with a -mask option.

-Jukka Rahkonen-

Lähettäjä: Nyall Dawson <nyall.dawson at gmail.com>
Lähetetty: tiistai 5. marraskuuta 2024 2.51
Vastaanottaja: Even Rouault <even.rouault at spatialys.com>
Kopio: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>; 'gdal-dev at lists.osgeo.org' (gdal-dev at lists.osgeo.org) <gdal-dev at lists.osgeo.org>
Aihe: Re: [gdal-dev] How to locate where the raster min and max values are?


>
> I would like to know the georeferenced coordinates of the min and max values of a DEM file. Even better if I could forward them into a vector file. If the minimum or maximum happens to be on a flat area like seabed I would be happy with the first pixel at the moment.
>
> The task feels rather simple and I was sure that someone has already made an utility or a QGIS plugin, but all I have found yet is for R

I've submitted a processing tool for QGIS 3.42 to do this here: https://github.com/qgis/QGIS/pull/59332 . This uses Even's new GDAL api so should be super-efficient & fast to calculate. 🥳

Thanks for raising this interesting discussion, a lot of nice things have come out of this!

Nyall

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241105/76805b46/attachment-0001.htm>


More information about the gdal-dev mailing list