Select to view content in your preferred language

arcpy.env.cellSize returns 'MAXOF' instead of numerical value

533
2
08-23-2011 07:09 PM
HenryColgate
Occasional Contributor
I'm having some trouble with using arcpy to obtain the cell size of datsets when run in IDLE Python.

The code I am using reads the full path from a list of ECW files in a CSV and attempts to get the cellsize info using 'arcpy.env.cellSize':

for row in csvReader:

arcpy.env.cellSize = row[1]
cellSizeVal = arcpy.env.cellSize

This provides the result I want some of the time (e.g. 0.5) which is correct. However a lot of the time I am getting the value 'MAXOF' returned. However when I view the dataset in ArcView it has the value I am looking for. This data is generally available via an associated ERS file though it is more difficult to read and the ERS is not always available.

I am curious why I sometimes get the desired value and sometimes get the value MAXOF. Especially when the value is 'always' available in ArcView under the layer properties.

Cheers,

HC
Tags (2)
0 Kudos
2 Replies
Luke_Pinner
MVP Regular Contributor
Get cell size directly from the raster band:
for row in csvReader:
    desc = arcpy.Describe(row[1]+"/Band_1")
    cellSizeVal = desc.meanCellWidth
    arcpy.env.cellSize = cellSizeVal
0 Kudos
HenryColgate
Occasional Contributor
Magic.

Thanks for your help.
0 Kudos