Robin's Blog

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:

  1. Run the Spatial Analyst -> Conditional -> Set Null tool

  2. Set the input conditional raster to be the raster dataset which you want to change

  3. Set the expression to VALUE = 9999 where 9999 is the value that you want to replace with NoData.

  4. Set the Input false raster or constant value to the same raster dataset that you select in step 2.

  5. Choose a sensible output raster. The dialog should look roughly like this (click for more detail):

 

  1. 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


16 Comments

  1. rw says:

    How about the opposite: change NODATA to a value?

  2. 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!

  3. travis says:

    than you so much for this! saved me a ton of time.

  4. idham says:

    Thanks mate! Really helpful.

  5. Shahin says:

    Thanks

  6. jose says:

    but i got error? why?

  7. Prasarn says:

    Thank you very much.

  8. MM says:

    Thanks. This is just what I was looking for. Great Blog!

  9. […] How to: Set raster values to NoData easily in ArcGIS 10 […]

  10. David says:

    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.

  11. Aicam says:

    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

  12. Mahyar says:

    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.

  13. Gunin Gogoi says:

    Thanks Robin for the explanation and pictorial presentation. It works excellent for me!!

  14. Elena says:

    Thank you Robin. I didn’t know that tool. Very helpful!!

  15. Debbie says:

    So helpful. Thanks for this easy fix. I really appreciate the clear example.

    Cheers!

  16. Psalterium says:

    @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!

Leave a Reply

Your email address will not be published. Required fields are marked *