4

I have a raster that I would like to filter based on values in a second raster in QGIS. Is there an easy way to do this? I have tried messing around with the raster calculator but not sure if there is a better tool/plugin for the job. In Arc there are some tools for filtering/extracting raster data based on values.

This relates to surface water modelling. I have 2 output raster files, max water depth and max hazard rating. I would like to filter out (or make invisible) all data in the depth file that does not overlap with a hazard rating value >= 0.575.

7
  • 1
    Are you asking how to create a mask?
    – Erik
    Commented Jun 17, 2021 at 10:03
  • You should provide more information about what exactly you intend to do - there are different tools for different tasks. So normally, use-cases are quite specific like this here: gis.stackexchange.com/a/396622/88814
    – Babel
    Commented Jun 17, 2021 at 10:07
  • Hi Erik. Well, is this the only workflow to achieve this? 1) Create mask raster file in raster calculator 2) convert raster to vector file. 3) Clip original rater using vector mask? Commented Jun 17, 2021 at 10:10
  • I'll add dome more info below... Commented Jun 17, 2021 at 10:11
  • This relates to surface water modelling. I have 2 output raster files, max water depth and max hazard rating. I would like to filter out (or make invisible) all data in the depth file that does not overlap with a hazard rating value >= 0.575. Commented Jun 17, 2021 at 10:12

1 Answer 1

2

Raster calculate:

("hazard@1">=0.575)*"depth@1" + ("hazard@1"<0.575)*-99

To use depth raster where hazard >=0.575, and -99 where hazard <0.575

In my example I use <5: enter image description here

Then translate to set nodata value to -99 (or set additional no data value to -99 in layer styling): enter image description here

enter image description here

2
  • 1
    Great, thanks very much! I'll give that a go. Commented Jun 18, 2021 at 6:58
  • 1
    Thanks BERA, that was perfect! Cheers! Commented Jun 18, 2021 at 7:15

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.