1

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?

david_p
  • 1,783
  • 1
  • 19
  • 34
  • 1
    Arcpy.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 http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/uniquevaluessymbology-class.htm. – Richard Fairhurst Feb 02 '16 at 21:00
  • I agree with @RichardFairhurst http://gis.stackexchange.com/questions/61147/using-unique-values-symbology-in-arcpy and http://gis.stackexchange.com/questions/89271/using-arcpy-is-there-a-way-to-change-the-color-of-a-symbol-in-a-uniquevaluessym ask similar questions and I think yours may be a duplicate of the latter. – PolyGeo Feb 02 '16 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 Feb 03 '16 at 07:42

0 Answers0