I have a classified image of 10 classes stacked together. Once I put them into ArcMap they don’t appear as 10 individual classes, they look like one big class.
When I click on unique values the following is the result
Once I compute the unique values the 10 classes are created
After adding all the values these 10 classes appear on table of content
I am trying to do the similar process through arcpy script, but I could not find any methods which could enable me to do the same.
import arcpy
... mxd = arcpy.mapping.MapDocument("current")
... lyr = arcpy.mapping.ListLayers(mxd, "IDSI_2002.img - Layer_1")[0]
... if lyr.symbologyType == "UNIQUE_VALUES":
... #lyr.symbology.valueField = "SUB_REGION"
... #lyr.symbology.addAllValues()
... print "we are not able to reach here"
... print (lyr.symbology.classLables)
...
... print (lyr.symbology.classLables)
... arcpy.RefreshActiveView()
... arcpy.RefreshTOC()
... del mxd
My layer has unique values but still it is now able to show Lables or Values if i try to print Lables without checking the for UNIQUE_VALUES it gives the following error
Runtime error
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "c:program files (x86)arcgisdesktop10.3arcpyarcpyarcobjects_base.py", line 78, in _get
(attr_name, self.__class__.__name__))
NameError: The attribute 'symbology' is not supported on this instance of Layer.