I have a slope raster and a road raster. The black pixels in the road raster are NoData values and the pink pixels have a value of 1. They don't cover exactly the same area.
I want to create a new raster based on the slope raster, except for pixels where there is a road pixel. If there is a road pixel, I want to assign a value of zero to the slope raster.
I am not quite sure how the formula needs to look like.
I tried the following, put it didn't give me the expected results:
r.mapcalc "output = ((Slope+(Road*null())))"
Any ideas?
Best Answer
Use this
r.mapcalc
expression:because:
if(Road)
is equal to 1 ifRoad
not zero, 0 otherwise.not(if(Road))
is equal to 0 ifRoad
not zero, 1 otherwise.