6

I'm working with DEM in QGIS and need to know the min and max values of my data. In the Properties window, under the Metadata tab, the statistics section shows such values. However, I usually find some pixels with values higher than the max and lower than the min.

Is there another way to obtain these values?

I've tried this with several DEMs.

4
  • Could you please tell us how you do know the max and min of the DEMs? (Possibly what you think you know is incorrect...)
    – whuber
    Commented Apr 22, 2013 at 20:59
  • I just made an elevation colormap based con the min max values calculated by QGIS and noticed some pixels were "left out" and colored white. I manually inspected them and noticed they were, respectively, above and below the maximum and minimum.
    – Andres
    Commented Apr 29, 2013 at 15:13
  • Calculated how, precisely? Do you mean as shown on a default legend? Or formally calculated by some procedure intended to compute these statistics for analytical purposes?
    – whuber
    Commented Apr 29, 2013 at 15:45
  • QGIS calculates in the Style tab (Properties dialog) min max values for grayscale stretching. I used those values (I don't know hoy QGIS calculates them) to make a colormap. Noticing some pixels were left out, I inspected them manually with Value Tool plugin.
    – Andres
    Commented Apr 30, 2013 at 16:35

2 Answers 2

12

By default, QGIS does not calculate the full range for a raster. The range it calculates by default is 2% - 98%, see the 'Cumulative count cut' option in the 'Load min/max values' section of the dialog box. This is just the first option, which is why (I suspect) it is the default.

To get the full range, choose the option below it marked 'Min/max', then select 'Full' for Extent (default) and 'Actual (slower)' for Accuracy (the default is 'Estimate (faster)'). With these options all selected, click the 'Load' button at the bottom of this section of the dialog box. This loads the statistics and you will see them appear in the min max boxes in the appropriate part of the dialog box (depending on whether you are generating a single-band grey or pseudocolor palette).

4
  • I don't find any "Cummulative count cut" in the "load min/max values" section (Style tab in Properties dialog, right?). There I just find "estimate (faster)", "actual (slower)" and "current extent". Estimate and actual give the same (incomplete) results; only "current extent" (at full extent, of course) returns the true min and max values (which I have to load each time I open the Properties dialog). In the Metadata tab, min max values seem to be always estimates. Though it seems awkward that "actual" min max values are only an estimate, I now know how to get the real values. Thanks a lot!
    – Andres
    Commented Apr 29, 2013 at 15:25
  • 1
    Ah! I am using v1.9 which has a much better interface for rendering rasters (in my opinion). That said, I just did a little comparison with a couple of DEMs and get the same (correct) min/max values in both 1.8 and 1.9 even when zoomed in (except for when I select 'current extent') so unfortunately I'm not able to reproduce your issue. I'm using the latest version of 1.8. Maybe there's some change since you downloaded your version? Commented Apr 29, 2013 at 18:07
  • 1
    Maybe it's the version. Raster statistics in QGIS is not quite what I wish it would be. Other statistics are simply not calculated. I'll see if I have to update. Cheers
    – Andres
    Commented Apr 30, 2013 at 16:38
  • Does not setting it to 'Actual (slower)' affect calculation of slope, aspect or whatever based on this raster layer? or is it just for vizualising purposes?
    – Khaled
    Commented Jul 22 at 15:59
0

In the main menu is the "raster" submenu. In there is the option "miscellaneous" and, in there, is the option "information".

This helped me in finding the min and max value.

Also, the plug-in "statistic raster pixel" do the trick, but it misses some decimals.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.