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.

When using Spatial Analyst I regularly have issues with NoData values cropping up in the data.

Various tools appear to introduce NoData values regularly.

These values then cause issues with other tools and have to be eliminated with reclassification, usually resulting in other problems.

How should NoData values be dealt with? Is there a simple way to replace NoData values with zero? Can NoData be avoided altogether?

share|improve this question
3  
Usually--but not always--the NoData value has to be there. This prevents the entire operation from failing when it might fail separately at just a few cells. Good examples are divide by zero, logs of non-positive numbers, and various local operations attempted along boundaries of the grid. One of the few good examples I know concerning where NoData values should not be introduced is focal majority/minority, which resolve ties by setting them to NoData! –  whuber Apr 11 '11 at 17:37
1  
Also, there is a distinction between finite NoData (e.g., -9999), and 1.#QNAN NoData. In ArcGIS the former is transparent, while 1.#QNAN NoData is opaque black. –  Mike T Apr 11 '11 at 19:41

2 Answers 2

up vote 4 down vote accepted

I would have used the raster calculator with the following expression:

Con(IsNull([raster]), 0, [raster])

It assumes that your raster is called 'raster'.


The 10.x Raster Calculator tool syntax is slightly different. In this example, "raster" is a layer in the map:

Con(IsNull("raster", 0, "raster")
share|improve this answer

You can set NoData values to any value using the conditional operator Set Null ( ArcGIS 9.3, ArcGIS 10). I'm not aware of a way of preventing the NoData from appearing in the first place, though.


I realized I should have written/linked to the Con operator as @AndOne mentioned.

From the documentation, if you use python:

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outCon = Con("elevation", "elevation", "", "VALUE > 2000")
outCon.save("C:/sapyexamples/output/outcon.img")
share|improve this answer
1  
+1. Many of the operations have arguments that limit NoData results. E.g., when computing neighborhood ("focal") statistics you can specify that NoData in the input (which must occur around the edges) simply be ignored rather than propagated to the output. Note that every planar grid has a boundary beyond which are NoData. –  whuber Apr 11 '11 at 17:40
    
Can this actually be used to convert NoData into zero? –  Matthew Snape Apr 12 '11 at 11:13
    
Yes, which version of ArcGIS are you using? –  djq Apr 12 '11 at 19:01
    
Verions I am using is Arcgis 10.0 –  Matthew Snape Apr 13 '11 at 15:31

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.