Raster to ASCII - change NoData from -9999 to a single digit?

6582
5
02-24-2015 02:38 PM
RachelMedina2
New Contributor

I am converting rasters to ASCII files. All of my raster cells have values of 0, 1, 2 or no data. When I make the conversion, the NoData value becomes -9999 but this becomes a problem when I import the text file into excel. Since -9999 is five spaces, this does not make my columns split correctly and I end up with 0's and 1's in one cell together. I would like to change my NoData from the default value of -9999 to 9 or some other single integer either before or after the conversion. Does anyone know how to go about this or am I stuck fixing one by one?

0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

hmmmmm have you tried to set the nodata value in the raster prior to exporting?  There doesn't appear to be a way to do it during the export nor after it is done.

0 Kudos
XanderBakker
Esri Esteemed Contributor

You can use the raster calculator to assign a different value to the NoData cells:

Con(IsNull(InputRaster),9,InputRaster)

... but I am wondering, are you using a space to convert the text to columns? That should also solved the problem.

A question; what will you be doing with the raster in Excel? Maybe these things are also possible in ArcGIS...

0 Kudos
RachelMedina2
New Contributor

Thank you both, Ill just have to assign a value for NoData in raster calculator before the conversion to ASCII. I have aquatic invasive species data that I am trying to create Absence/Presence rasters for so I would rather not include the land otherwise I have 3 different values. I am trying to prepare the data for Maxent to use in a program called SAHM which needs data in ASCII form. When looking at the file though I thought that it had produced all NoData (-9999) values. But I have realized that the extent of my raster is bigger than the actuall shape of the raster I need (state of Colorado). SO now I am curious how I can clip my raster to the actually geometry of the shape of Colorado and not the extent which is meters further out in each direction. Any ideas?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Did you have a look at the Clip tool to clip the raster? ArcGIS Help (10.2, 10.2.1, and 10.2.2)

0 Kudos
DanPatterson_Retired
MVP Emeritus

There will always be nodata area in rasters and their ascii representation unless the area is completely rectangular in projected coordinates, and aligned perfectly with the X-Y axes (although some software allows for rotation terms).  So to get your ascii output in the exact shape of Colorado, isn't going to happen if you are using projected data and a larger extent.  Just symbolize the nodata values so it isn't obvious

0 Kudos