How to: Set raster values to NoData easily in ArcGIS 10
While processing some data at work today I had an issue where I had a raster dataset in ArcGIS, where all cells with invalid data had been set to 9999. Of course, this caused a lot of issues for the statistics on the dataset – basically they were all nonsense – so I needed to fix it. I couldn’t seem to get reclass to work properly with floating point data, so I posted a question to the GIS StackExchange site. Within a few minutes I had a couple of answers: one suggesting a possible way using the interface, and one suggesting a method using the ArcPy API.
However, I managed to find a way to do this easily using the approach recommended for ArcPy in the response from Aragon (thanks!), but using the GUI interface. To do this, follow the instructions below:
-
Run the Spatial Analyst -> Conditional -> Set Null tool
-
Set the input conditional raster to be the raster dataset which you want to change
-
Set the expression to VALUE = 9999 where 9999 is the value that you want to replace with NoData.
-
Set the Input false raster or constant value to the same raster dataset that you select in step 2.
-
Choose a sensible output raster. The dialog should look roughly like this (click for more detail):
- Click OK
It’s done! Your new raster should have all of the values of 9999 replaced with NoData, and your statistics should work fine.
If you found this post useful, please consider buying me a coffee.
This post originally appeared on Robin's Blog.
Categorised as: Academic, GIS, How To
How about the opposite: change NODATA to a value?
Thanks for all your blogging! I will find many of your articles extremley useful for my Bachelor thesis. I will try some remote sensing of dunes on Mars.
You have a new reader!
than you so much for this! saved me a ton of time.
Thanks mate! Really helpful.
Thanks
but i got error? why?
Thank you very much.
Thanks. This is just what I was looking for. Great Blog!
[…] How to: Set raster values to NoData easily in ArcGIS 10 […]
Came across this looking for a quicker way to set nodata values in a raster. SetNull was giving me an error.
I eventually found a way using the Set Raster Properties in the Data Management / Raster / Raster Properties tool.
The value of this one is that you don’t have to create a new raster, but can set the nodata value in your existing raster, which saves processing time if you’ve got big rasters. Also, because Spatial Analyst creates an old-style ArcGrid dataset as an intermediate step, you can run into file-size limitations for large datasets. I was running on some 10+GB files (hence the error), so SetNull bombed, but Set Raster Properties worked.
I am still having issues with set null; It seems it only work with integers? It is not allowing me to set null for float.
Thanks
Words really cannot describe how thankful I am. Awesome straightforward method.
To Aicam: I actually could get it to work on my floating data. Just find out the invalid value you wish to change. Then, simply write value = you invalid value.
Thanks Robin for the explanation and pictorial presentation. It works excellent for me!!
Thank you Robin. I didn’t know that tool. Very helpful!!
So helpful. Thanks for this easy fix. I really appreciate the clear example.
Cheers!
@rw
Because nobody answered the question yet: For the opposite operation, setting a new value for NoData, use the IsNull tool in combination with Con.
1) Spatial Analyst Tools > Math > Logical > IsNull
This will give a 1/0 Raster as output with NoData = 1
2) Spatial Analyst Tools > Conditional > Con
Choose the output of 1) as input, Expression is ‘VALUE = 1’ to select the NoData cells, Input true is your desired value i.e. -9999; Input false is your original raster to get the rest of your values back!