0

I'm a new user of QGIS and learning some tips from this book https://www.amazon.com.au/Learn-QGIS-Andrew-Cutts/dp/1788997425. I'm currently practising how to use raster calculator to find areas at elevations > 1000 m with a slope < 5 m.

enter image description here

  • After that I used Slope tool for this DEM_local to make a new slope layer.

enter image description here

  • Use raster calculator to find elevations > 1000m and Slope < 5m

enter image description here

Although I followed book guides the result layer was still disable. Some previous posts said it's caused by improper layer names or projections. As they suggested, I've changed srtm_05_01 to srtm0501 or checked projections , but the problem still remains.

enter image description here

The range of raster_calculator_eg should be 0 - 1 (similar to this book) instead of +/- 1.79769e+308

Could anyone please help me?

0
2

Your issue is with the formula in the Raster Calculator. The calculator works by creating a mask ( Trues/Falses ). After that, you have to assign a value to the Trues. For instance, the expression you used:

"srtm_01_05@1" > 1000 AND "Slope@1"< 5

It will create a mask where pixels that follow those two conditions will be true and the ones that do not will be false. However, you are not assigning anything to those pixels after the mask is created. Try the expression below:

("srtm_01_05@1" > 1000 AND "Slope@1"< 5) * "srtm_01_05@1"

By doing so, the pixels that are true for the condition will be assigned the equivalent pixel in the srtm and the ones that don't will be NoData.

Moreover, it's good practice to have both rasters with the same CRS. Therefore, I suggest having both with the same EPSG using gdalwarp. Then run the Raster Calculator.

I hope that helps.

J.

2
  • 1
    +1 to have both rasters with the same CRS – Kazuhito May 31 '20 at 0:07
  • Thank you so much. It's worked! I've used GDAL to reproject CRS. Anyway it's different from those steps shown in book – Lam Nguyen Jun 1 '20 at 3:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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