I'm trying to reclassify the pixel values of NLCD_2011 data to a binary representation of developed vs. undeveloped land.

    import arcpy

    nlcd = ('file path for the layer file')
    binary_landcover = ('destination file path')

    remap_value = "RemapValue([[11,0],[12,1],[21,0],[22,0],[23,0],[24,0],[31,1],[41,1],[42,1],[43,1],[51,1],[52,1],[71,1],[72,1],[73,1],[74,1],[81,1],[90,1],[95,1]])"
        # 11 Open Water
        # 12 Perennial Ice/Snow
        # 21 Developed, Open Space $
        # 22 Developed, Low Intensity $
        # 23 Developed, Medium Intensity $
        # 24 Developed, High Intensity $
        # 31 Barren Land
        # 41 Deciduous Forest *
        # 42 Evergreen Forest *
        # 43 Mixed Forest *
        # 52 Shrub/Scrub
        # 71 Grassland/Herbaceous **
        # 81 Pasture Hay **
        # 82 Cultivated Crops ***
        # 90 Woody Wetlands 000
        # 95 Emergent Herbaceous Wetlands 000
    #temp2 = Reclassify(nlcd, "VALUE", remap_value, 'NODATA')
    arcpy.gp.Reclassify_sa(nlcd, 'VALUE', remap_value, binary_landcover, "NODATA")

I've tried doing this, in python, using the 'Map Algebra' method, which ESRI documentation seems to deem preferable, and by just calling up the reclassify function. With both approaches the same thing happens, the function runs as expected, but when I load the output, it seems like the actual pixel values aren't changed. The only difference I can see is that the only remaining field is the field I targeted for remapping.

enter image description here properties of output layer

I tried doing the same thing in ArcMap, and it worked successfully.

enter image description here

I can't figure where I am going wrong trying to recreate my successful manual execution of the task in python.


2 Answers 2


The RemapValue is an arcpy.sa (Spatial Analyst) object. By not referencing the spatial analyst module, the script doesn't know what to do with your RemapValue statement. The easiest fix would probably be to include the following at the beginning of your script...

import arcpy
from arcpy.sa import *

Alternatively, I believe you could alter your Remap Value itself...

remap_value = "arcpy.sa.RemapValue(...)"

I had my remapping value saved as a string rather than a list. I'm not sure how the function was running with the wrong input, but by changing the remapping value to a list it worked perfect!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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