Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two rasters (an ESRI grid and an IMAGINE image) that differ in projection, extent and cell size. I want to convert the IMAGINE to an ASCII, and want it to have the extent, cell size and projection of the ESRI grid. I've set global environment variables (extent, output CRS, cell size, snap raster) to match the values in the ESRI grid, and the ASCII that results from RasterToASCII_conversion has the correct projection and extent, but ignores the cell size setting.

However, if I use the Raster and ApplyEnvironment tools (see code below) from the Python console, the output is as expected (correct cell size, extent, etc).

import arcpy
arcpy.env.extent = 'c:/path/to/grid'
arcpy.env.cellSize = 'c:/path/to/grid'
arcpy.env.outputCoordinateSystem = 'c:/path/to/grid'
arcpy.env.snapRaster = 'c:/path/to/grid'
r = arcpy.Raster('c:/path/to/imagine')
rclip ='c:/path/to/outfile')

While I could do the above and then convert the resulting grid to ASCII, I'd prefer to do the whole procedure without using Spatial Analyst. Is this possible?

I'm using ArcGIS 10.

share|improve this question

Even within Arcmap, you have to set the settings within the Environments tab of the tool being used in Arctoolbox, otherwise the cell size is set the 1/250th of the maximum of the extent (width/height maximum). There is no default to the defaults and your procedure seems fine...seems that you could create a simple tool to simply the workflow without having to replace the paths in multiple lines.

share|improve this answer
So, there's no way to set the cell size environment variable with Python, and get RasterToASCII_conversion to pay attention to it? I had thought that setting the arcpy.env. variables would do the trick. Is there another group of env variables that needs to be set? Ideally, I'd like to process these rasters with Python, and avoid Spatial Analyst. – jbaums Jun 7 '11 at 2:13

Your Answer


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.