I have some ArcMap addin that creates new layer and add it into table of content. I need to set up a symbology for the newly created layer based on the attribute table (three differnet values> three diferent colours). Is it possible to manage symbology that way using Python (arcpy.mapping module)?
This is part of my script, but it's only add labes:
mxd = arcpy.mapping.MapDocument("CURRENT")
data_frame = mxd.activeDataFrame
layer_divide = arcpy.mapping.ListLayers(mxd, "layer", data_frame)[0]
if layer_divide.supports("LABELCLASSES"):
for lblclass in layer_divide.labelClasses:
lblclass.expression = '"{}" + [FID] + "{}"'.format("<FNT size = '20'>","</FNT>")
lblclass.showClassLabels = True
layer_divide.showLabels = True
arcpy.RefreshActiveView()
I can't find any help how to specify a symbology. Is it even possible?
asked Feb 2, 2016 at 19:59
-
1Arcpy.mapping is very limited when it comes to symbology. Generally you have to borrow the symbology from an existing layer/layer file or else let it assign random colors to all of the field values using UniqueValuesSymbology desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/….Richard Fairhurst– Richard Fairhurst2016年02月02日 21:00:21 +00:00Commented Feb 2, 2016 at 21:00
-
I agree with @RichardFairhurst gis.stackexchange.com/questions/61147/… and gis.stackexchange.com/questions/89271/… ask similar questions and I think yours may be a duplicate of the latter.PolyGeo– PolyGeo ♦2016年02月02日 22:15:45 +00:00Commented Feb 2, 2016 at 22:15
-
So in fact it's impossible to set symbology exact based on attribute table like Value 1 is blue, Value 2 is red an so on? I don't have any layer that I could copy symbology from.david_p– david_p2016年02月03日 07:42:41 +00:00Commented Feb 3, 2016 at 7:42
lang-py