Hello,
In ArcGIS Pro, I have two layers: one Line and one Point. Both have a field named SEB, and this field contains the same values.
For the line layer, I applied Unique Values symbology based on the SEBfield. This created about 40,000 groups, each with a different color.
Now I want to apply the same symbology to the point layer. However, ArcGIS Pro automatically assigns different colors. What I need is: if the value in the SEB field is the same, then the point layer should use the same color as the line layer.
How can I do this in ArcGIS Pro?
Thanks!
@JohnGoat - so I'm wondering if you can setup attribute driven symbology for the SEB field? You can learn more about how to do this workflow here:
Attribute-driven symbology—ArcGIS Pro | Documentation
Setting up the attribute-driven color in symbology... - Esri Community
This could be done with arcpy and CIM. This is not a robust script, but it worked on my test data. Fingers crossed you can just update `pts` and `lines` and it will work for you too.
'''
This script assumes you already have both layers set up with unique symbology on the target field.
It will only update colors in the points for unique values also found in the lines
It will not change symbology rendering style (e.g. Unique Values vs Single Symbol vs Graduated Colors)
It will only work if every color is set up in HSV space (having RGB colors will break it)
'''
import arcpy
## Define your point and line layers in the TOC, and the common Field Name for symbology
pts = r"point"
lines = r"lines"
aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.activeMap
line_lyr = m.listLayers(lines)[0]
pt_lyr = m.listLayers(pts)[0]
## Define a dictionary of field value and color definition
d_color = {}
for group in line_lyr.symbology.renderer.groups:
for item in group.items:
val = item.values[0][0]
color = item.symbol.color
d_color[val] = color
## Update symbology of the points
cim = pt_lyr.getDefinition('V2')
for group in cim.renderer.groups:
for cls in group.classes:
#get name
val = cls.values[0].fieldValues[0]
# color goes here
cls.symbol.symbol.symbolLayers[0].markerGraphics[0].symbol.symbolLayers[1].color.values = d_color[val]['HSV']
pt_lyr.setDefinition(cim)