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.

Taras
  • 32,823
  • 4
  • 66
  • 137
  • 1
    Are you asking how to create a mask? – Erik Jun 17 '21 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: https://gis.stackexchange.com/a/396622/88814 – Babel Jun 17 '21 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? – Henry Kelly Jun 17 '21 at 10:10
  • I'll add dome more info below... – Henry Kelly Jun 17 '21 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. – Henry Kelly Jun 17 '21 at 10:12
  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short [tour] for more about how the site works – Ian Turton Jun 17 '21 at 10:19
  • Hi Ian. Thanks for that, I'll take a look. – Henry Kelly Jun 17 '21 at 10:27

1 Answers1

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

BERA
  • 72,339
  • 13
  • 72
  • 161