3

enter image description here

I need to set cell values in one raster to NoData based on another raster. Both rasters have the same extent and some cells overlap. For those cells that overlap I want to set them to NoData in Raster1 while keeping the rest of the cell values.

Please see graphic: Raster1 (green); Raster2 (black). I need to replace the cell values in Raster1 that overlap Raster2 with NoData while keeping the rest of the cell values in Raster1.

I'm using the SetNull function in Raster Calculator but I'm getting a blank raster so I guess the expression is not quite right.

SetNull("%Maas_Vol_47_com%","%Maas_Vol_47_inc%")
Raster1 = Maas_Vol_47_com
Raster2 = Maas_Vol_47_inc
  • You have the right idea. The problem is that "%Mass_Vol_57_com%" likely is not a logical raster: it has numeric codes. You need to replace this by a logical expression identifying the areas of overlap. This procedure is illustrated in several dozen threads on this site; find them with a search on "SetNull" plus the name of whatever GIS software you are using or use a generic search on Setnull alone. – whuber Sep 6 '13 at 15:35
1

Well this is how I would have done it, although I bet someone could offer a smarter way of doing it?

  1. Give all the cells in your black raster a much higher number than anything in your green raster, you can do this by using the plus tool.
  2. Using the mosaic to new raster tool (make sure pixel type supports that high number) and set mosaic operation to maximum to create a new raster called X. You are mosaicking your green raster with the raster created by the plus tool (step 1).
  3. Run the setnull tool setting conditional raster to be X, expression to "Value = your high number" and input false raster to X.
  • That makes the trick for now. Thanks. If anyone else comes with an easier solution please let me know. Cheers – Tonalca Sep 6 '13 at 12:27
  • If your question has been answered you should flag it so and vote any answers/comments up or down as appropriate. This allows others who come searching for a similar answer know you got a solution. – Hornbydd Sep 6 '13 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.