Hello,
I am trying to extract the style from the selected layer using Arcpy; but, it seems like there are no properties like color, size, font, etc,...
I run this code on the Python console in ArcMap:
mxd = arcpy.mapping.MapDocument("CURRENT")
layers = arcpy.mapping.ListLayers(mxd)
exampleLayer = layers[0] # This is Feature layer
# I want to get properties like color, size,... from the layer
# But it is not supported
I am hoping someone can help me out!
Many thank!
Solved! Go to Solution.
It won't be easy if at all.... here is the path to follow in the help
UniqueValueRenderer—ArcGIS Pro | Documentation
Item—ArcGIS Pro | Documentation
Symbol—ArcGIS Pro | Documentation
Thanks for your help, it looks like I have to use arcpy.mp (Python 3) instead of arcpy.mapping (Python 2) to read these properties like color, size, or font.
It means I have to use ArcGIS Pro instead of ArcGIS Desktop because of this
Refer to the arcpy documentation for the Layer class. You'll see that by calling various properties, like exampleLayer.symbology and exampleLayer.symbologyType, you can access the layer's properties you're looking for.
Thanks for your quick response, but I have tried it before.
In my case, the exampleLayer.symbology is UniqueValuesSymbology . It has properties like description, labels, value, and the value field. But what I want is properties like color, size, font,...
It won't be easy if at all.... here is the path to follow in the help
UniqueValueRenderer—ArcGIS Pro | Documentation
Item—ArcGIS Pro | Documentation
Symbol—ArcGIS Pro | Documentation
Thanks for your help, it looks like I have to use arcpy.mp (Python 3) instead of arcpy.mapping (Python 2) to read these properties like color, size, or font.
It means I have to use ArcGIS Pro instead of ArcGIS Desktop because of this
Thats right... CIM has only been recently introduced and not backported to ArcMap.
Time to move on, python 2.7 is done in any event and ArcMap will be terminal soon 😉