Zonal Stats as Table ERROR 010024: Error during conversion.

2009
3
06-30-2011 03:44 PM
AndrewBlakey1
New Contributor II
I have a small script that takes in a feature set and returns a table  via. Zonal Statistics as Table.  A raster that is hardcoded is used. If I create this in model builder it works fine, but in python it returns "ERROR 010024: Error during conversion"

I spent a few hours troubleshooting and can't identify why it wouldn't work properly.  The error refers to a conversion error, but I can't seem to see what is wrong.  The Zonal Stats as Table help says it accepts a Feature Layer but not a Feature Set, however a Feature Set seems to work just fine in the Model Builder implementation.

# Import arcpy module
import arcpy

# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")

inputFS = arcpy.GetParameterAsText(0)
tableResult = arcpy.GetParameterAsText(1)

downtown_solar3pt5_Year = "D:\\TorontoData\\ArcServer Published Data\\Map Data\\Toronto Solar Main.gdb\\downtown_solar3pt5_Year"

arcpy.gp.ZonalStatisticsAsTable_sa(inputFS, "OBJECTID", downtown_solar3pt5_Year, tableResult, "DATA", "ALL")


The inputFS (feature set) has a schema set in both the python and model implementations.

Any help or suggestions would be appreciated!
Tags (2)
0 Kudos
3 Replies
JeffLee
New Contributor II
Andrew;

    A couple of things come to mind.  First, Spatial Analyst does not like spaces in directory path.  Second, the raster is stored in a geodatabase and if I am not mistaken, Spatial Analyst converts the raster in the geodatabase to an ESRI grid format before performing the operation, Since your file name exceeds 13 characters, this may be where the error comes up.  Hope this helps.
0 Kudos
AndrewBlakey1
New Contributor II
Hi Jeff:

Thanks for those suggestions. I tried them and it looks like ArcServer properly accounts for both spaces and long file names. It also didn't matter what format then input rasters were in.

However, your suggestions got me thinking a bit more about file input/output and I realized that I was setting a scratch workspace to a directory that was being used as the scratch directory for ArcServer. There seems to be a lock of sorts that causes a conflict. Setting this to a generic location fixed the problem.

Thanks again,
Andrew
0 Kudos
Cameronoaki
New Contributor

I had the same conversion error when iterating feature classes through zonal statistics as table on a raster layer.  After a long period of troubleshooting, I determined the fix was the processing extent of the model.  It successfully ran once I set the zonal stat as table tool processing extent to the same extent as the shapefile layer that defined the zones.  I hope this helps someone out there. 

0 Kudos