Clipping raster by raster (0-1 range) using QGIS

clipmaskingqgisraster

I am supposed to clip 6 raster files of Europe by a raster of agricultural land in Europe (mask layer). Initially, to do that I vectorised my mask layer and then clipped the rasters by that. It seemed to work fine. I then normalised my outputs to all range from 0-1.

But my professor now says that I was not supposed to do it this way, since it causes “masking issues“ when comparing the output rasters. Specifically, he criticised that my output rasters don’t make it clear which pixels are no data and which are 0 and that when using a vector to clip it might create some “odd shapes”, i.e. cutting a cell in half. I checked my outputs and couldn’t see any evidence of this, but I have to redo my files anyway.

I’ve spent several days trying to figure out how to do the clipping using a raster as the mask layer instead, but couldn’t get it to give me outputs that make sense. Some things I tried:

Best Answer

Figured it out in the end by creating a new raster of the outline of my area with everything inside the area set as 1 and everything outside the outline set as NoData (set these when exporting the newly created file). Then multiplied my other rasters by this one in the raster calculator.

Related Question