Edit symbol layer drawing using python

319
0
03-05-2021 02:16 AM
HansR
by
New Contributor

I am using ArcGIS Pro 2.7 and I am currently working on creating layouts with geocoded data points. The data is stored in csv-files, after creating a feature class from this a new layer is created using a python toolbox. When introducing a graduated colors renderer data points overlapping each other are stacked in arbitrary order (as far as I understand based on the order they were returned from the database).

In ArcGIS Pro, what I have been doing to dictate the order in which data points are drawn is the following: Enable Symbol layer drawing and rearrange the different symbol layers using drag and drop in the layers symbology.

Trying to automate this using a python toolbox, my idea was to edit the layers CIM definition to achieve the same result:

Spoiler

lyr0 = map0.listLayers(FLname)[0]
cim_lyr = lyr0.getDefinition('V2')

# Edit CIM
cim_lyr.symbolLayerDrawing.useSymbolLayerDrawing = True

cim_lyr.symbolLayerDrawing.symbolLayers.reverse()


lyr0.setDefinition(cim_lyr)

However, when running this the drawing order seemingly does not change. The symbol layer drawing button in the symbology is not enabled and the symbol layers are no longer listed in the symbology. Instead, a warning appears "Requested operation could not be completed" :

HansR_0-1614938568769.png

 

Since this is my first post in this forum: did this question end up in the right spot?

Am I missing something here?

0 Kudos
0 Replies