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?

asked Feb 2, 2016 at 19:59
3
  • 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 desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/…. Commented 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. Commented 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. Commented Feb 3, 2016 at 7:42

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.