priyankasharma86

Reclassification using Python Script

Discussion created by priyankasharma86 on Jul 4, 2012
Latest reply on Jul 4, 2012 by m.gasior
Hi,

I am trying to perform reclassification on a shape file having several attributes. I am trying to call this attribute table and "LANDCOVER" column into my python script to perform reclassification.

I am using this python script to perform this:

fc = "D:\Priyanka\Model_tests\Reclassify_LU_Del\LANDUSE4_prj.shp"
fldName = 'LANDCOVER'
def reclass(landcover):
if landcover in ("Drain", "Lake", "River", "Water Body", "Canal"):
return "Water"
elif landcover in ("Green Area", "Open Space"):
return "Green and Open Space"
elif landcover in ("Island"):
return "Miscellaneous"
elif landcover in ("Others"):
return "Public Space"
else:
return landcover

But, I am getting errors "Invalid Syntax". I am sure that I am doing something wrong but dont know what! It would be great if you can please let me know how to perform reclassification on this attribute table and then incorporate the same to ARC Tool!

Thanks!

Outcomes