0

I want to convert polygon to raster. I converted the dbf file ( "cntymam") to table view to make use in the conversion. I am getting a error that the parameters are not called and also with the grid name. I am not able figure out the error.

Errors

ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000161: The length of the grid name must not exceed 13 characters
ERROR 000800: The value is not a member of CELL_CENTER | MAXIMUM_AREA | MAXIMUM_COMBINED_AREA.
Failed to execute (PolygonToRaster).

Script

# Make layer and table view

arcpy.MakeFeatureLayer_management(FLcounties, "flcnties")
arcpy.MakeTableView_management(cntymam2, "cntymam")

j=0

for species in mamList:
    if j < 10 :
        species_str = str(species)

        # polygon to raster 

        mamcnty_out = output_workSpace + "cnty_" + species_str

        Value_field = "cntymam2." + species_str

        print species_str, mamcnty_out, Value_field

        arcpy.PolygonToRaster_conversion("flcnties",Value_field, mamcnty_out, "CELL_CENTRE", "NONE", "90")

        print j
        j= j + 1
2
  • Hi Mukhtar, I edited you question a little so that the code was formatted correctly. To do that in the future, just insert 4 spaces in the front of any lines that you want to show as code. I don't have experience with RasterToPolygon, but I can tell you that the second error would be solved by changing "CELL_CENTRE" in your code to "CELL_CENTER".
    – mr.adam
    Apr 22 '15 at 15:23
  • Couple of things. First, set your workspace separately using env.workspace rather than concatenating it as part of mamcnty_out. Second, make sure that your grid name cannot exceed 13 characters - possibly by truncating it before your PolygonToRaster_conversion. See also help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//…
    – Andy
    Apr 22 '15 at 15:27
1

I see two fixes:

For the first error:

ERROR 000161: The length of the grid name must not exceed 13 characters

Convert your output to tiff format, which does not have the character length limitations that the Esri grid raster format does.

mamcnty_out = os.path.join(output_workSpace, "cnty_" + species_str + ".tif")

For the second error:

ERROR 000800: The value is not a member of CELL_CENTER | MAXIMUM_AREA | MAXIMUM_COMBINED_AREA. Failed to execute (PolygonToRaster).

You spelled "CELL_CENTER" wrong

arcpy.PolygonToRaster_conversion("flcnties",Value_field, mamcnty_out, "CELL_CENTER", "NONE", "90")
1
  • 1
    Thank you Aaron. TIFF file format is the right way for this task.I appreciate your efforts to help out me. Apr 22 '15 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.