Wednesday 23 January 2019

arcgis 10.2 - Create symbology for new layer using Python (arcpy.mapping)


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("","")

lblclass.showClassLabels = True

layer_divide.showLabels = True
arcpy.RefreshActiveView()

I can't find any help how to specify a symbology. Is it even possible?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...