I have a simple python script that runs a Weighted Overlay process. This script runs fine locally but when I publish it to ArcGIS Server and submit the job through the REST service page, it gave me this error message:
ERROR 999999: Error executing function.
The name of the Field is invalid: valid names may contain letters, numbers or underscores.
Failed to execute (WeightedOverlay).
Then I found out that somehow ArcGIS Server changes the raster field name from "VALUE" (as specified in my script) to "Value". This is the message from ArcGIS Server when running the process:
Executing: WeightedOverlay "('D:\raster1' 50 'Value' (1 1;NODATA NODATA); 'D:\raster2' 50 'Value' (1 1; 2 1; 3 1; 4 1; 5 1; 6 1; 7 1;NODATA NODATA));1 9 1" ....
But the same script when run from ArcToolbox locally will return:
Executing: WeightedOverlay "('D:\raster1' 50 'VALUE' (1 1;NODATA NODATA); 'D:\raster2' 50 'VALUE' (1 1; 2 1; 3 1; 4 1; 5 1; 6 1; 7 1;NODATA NODATA));1 9 1" ....
I've restarted the ArcGIS Server service and also restarted the server as well, but no luck.
UPDATE:
Here is the code:
sRasterGLA = arcpy.GetParameterAsText(0)
lRasters = []
lRemapObjects = []
lWOTable = []
lOverlayMapping_11NN = [[1,1],["NODATA","NODATA"]]
lOverlayMapping_1NN1 = [[1,"NODATA"],["NODATA",1]]
remap_11NN = arcpy.sa.RemapValue(lOverlayMapping_11NN)
remap_1NN1 = arcpy.sa.RemapValue(lOverlayMapping_1NN1)
iTemp = 1
lRasters.append(sRasterMandatory) # that's the directory path to the raster data
lRemapObjects.append(remap_11NN)
iTemp += 1
lRasters.append(sRasterGLA)
lRemapObjects.append(remap_1NN1)
iScale1 = int(100/iTemp)
iScale2 = 100 - iScale1 * iTemp
iParam1 = iScale1 + iScale2
iParam2 = iScale1
i = 0
while i < iTemp:
if i == 0:
lWOTable.append([lRasters[i], iParam1, "VALUE", lRemapObjects[i]])
else:
lWOTable.append([lRasters[i], iParam2, "VALUE", lRemapObjects[i]])
i += 1
WOTableObj = arcpy.sa.WOTable(lWOTable, lOverlayScaleStep_191)
outWeightedOverlay = arcpy.sa.WeightedOverlay(WOTableObj)
sOutput = os.path.join(arcpy.env.scratchFolder, "WOTEST1")
outWeightedOverlay.save(sOutput)
arcpy.SetParameterAsText(1, sOutput)