Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've got a really stupidly simple question, but I can't seem to work out how to do it.

I have a raster in ArcGIS which has a number of cells with the values 9999, showing that the data could not be generated for that cell. I want to convert all of these 9999 values to NoData, so that then I can do statistics on the dataset without getting crazy results.

How should I do this?

I have tried to use the reclassify tool, just adding one reclassification from 9999 -> No Data, but it seems to change all of the other values as well. Is there a way to do a reclassification which only does the changes you specify, and leaves all other values alone?

In case it matters, my dataset is a TIFF, with floating point values in it.

share|improve this question
    
Use setNull –  whuber May 2 '12 at 19:47

2 Answers 2

up vote 8 down vote accepted

you can do this with arcpy, if you want. In this code, any input cell with a value 9999 will be set to NoData in the output raster, and the remaining cells will retain their original value.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outSetNull = SetNull("elevation", "elevation", "VALUE = 9999")
outSetNull.save("C:/sapyexamples/output/outsetnull")

you can read Conditional evaluation with Con and Set Null (Spatial Analyst) from ArcGIS Resource Center...

Syntax
SetNull (in_conditional_raster, in_false_raster_or_constant, {where_clause})

SetNull

i hope it helps you...

share|improve this answer
2  
If you have Spatial Analyst then you could also use the Set Null tool - so, just what Aragon said but not bother with the scripting part :) –  MappaGnosis May 2 '12 at 12:38
1  
Using your link to Set Null (Spatial Analyst) I found that I could just run that without needing to use ArcPy. I've written a How To on my blog: blog.rtwilson.com/… –  robintw May 2 '12 at 12:44
    
yes this is another way. it is good to hear solving your problem. –  Aragon May 2 '12 at 13:31

Your approach used to work fine in old versions of Arc but not now. You can around this by adding in another value (set to be identical to the old one). One value is usually sufficient unless you have floating point values, in which case I would add the highest and lowest original values (set to be the same as their original value). The values in between USUALLY end up as per the original.

This is a hack, so always check the results afterwards!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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