1

I obtained a wetland raster online which has 10 different values for each type of wetland. It also has Nodata values for those pixels which do not contain any wetlands. However, the same 'Nodata' value has been given to land areas with no wetlands, as well as oceanic areas within the rectangular raster extent.

I need this wetland layer to determine distribution of fishing cats, which are obviously found only on land and not the sea, so I need the nodata values that fall on land to be a different value so that I can use that data for my analysis, and ignore the oceanic nodata values, which are non-applicable. Unfortunately, clipping the rectangular raster to a land vector mask (which is a shapefile) using the 'Clip raster by mask' doesn't exclude the ocean pixels so the same nodata non-differentiation remains.

Is there a way I can the nodata pixels that fall on land have different values from the nodata pixels on the sea? I'm using QGIS 3.22.16.

1
  • The first thing that comes to mind is to vectorize your raster to a shapefile restricted to your specific area with a reasonable buffer (you can trim later but it's always good to work with a few extra pixels outside) - give your nodata cells a value (gis.stackexchange.com/questions/12418/… may help) then edit the polygons generated to delete the area covering the sea and use that for a mask to clip by. Oct 19, 2023 at 7:18

1 Answer 1

2

Rasterize your land polygons, give the output the same cellsize and extent as your wetlands class raster. Make the output land value = the value you want to use to fill the wetlands nodata land areas and set 0 as the nodata value.

enter image description here

enter image description here

Then use the Grass r.mapcalc.simple tool with an expression like:

if(isnull(B), A, B) 

Where A = land raster and B = wetlands raster.

enter image description here

enter image description here

1
  • Hey, this worked a treat. Thanks a bunch. Sorry for the late reply. 2 days ago

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.