I've been trying to create a python script to loop through numerous shapefiles converting various fields to raster outputs.
I've been working off a lot of what has been said in this previous thread on the same issue -> Python loop Polygon to raster not working?
But can still not get it to work. I keep getting the dreaded 999999 error.
The code I've been trying is shown below:
#import arcpy module
import arcpy
from arcpy import env
#set working environment
env.workspace = "C:\\Users\\s175850\\Documents\\GIS\\GIS_Data\\Source_Methodology\\Pesticides\\Application_Term\\2008"
Dir = env.workspace
#List feature classes
fclist = arcpy.ListFeatureClasses()
#loop
for fc in fclist:
output = Dir + "\\r" + fc + "_ras"
cell = 5
#process polygon to raster
arcpy.PolygonToRaster_conversion(fc, "January", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "February", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "March", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "April", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "May", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "June", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "July", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "August", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "September", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "October", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "November", output, "CELL_CENTER", "", cell)
arcpy.PolygonToRaster_conversion(fc, "December", output, "CELL_CENTER", "", cell)
print "finished polygon to raster"
I'm not sure if there would be issues with outlining the 12 polygon to raster conversions for the 12 fields like I have done so I tried it with just one polygon to raster run for one field name. I still managed to get the same error.
I am using ArcGIS 10.