Currently the workflow is to split two different Feature Layer by an attribute which produces a lot of separate layers. Then use arcpy.Describe to apply symbology to the based on the layer type (point/Line).
act_map = aprx.activeMap
map = aprx.listMaps("Map1")
layers = act_map.listLayers()
for lyr in layers:
if(arcpy.Describe(lyr).dataType)=='FeatureLayer':
if arcpy.Describe(lyr).shapeType=='Point':
symbology = lyr.symbology
symbology.updateRenderer("SimpleRenderer")
symbol = symbology.renderer.symbol
symbol.color = {"RGB": [169, 0, 230, 100]}
symbol.outlineColor = {"RGB": [0, 0, 0, 100]}
symbol.size = 6
symbol.outlineWidth = 1
lyr.symbology = symbology # "re-set" property symboloy
This works but now we're adding another Feature Layer (Point) that will require separate Symbology. I have the idea to use "Fieldnames" to differentiate the two but can't figure it out.
Solved! Go to Solution.
I went to arcpy.ListFields(lyr) and was able to easier differentiate between the different point layers.
act_map = aprx.activeMap
map = aprx.listMaps("Map1")
OPField = "xxxx"
for lyr in layers:
fieldList = arcpy.ListFields(lyr)
for field in fieldList:
if field.name == OPField:
symbology = lyr.symbology
symbology.updateRenderer("SimpleRenderer")
symbol = symbology.renderer.symbol
symbol.color = {"RGB": [169, 0, 230, 100]}
symbol.outlineColor = {"RGB": [0, 0, 0, 100]}
symbol.size = 6
lyr.symbology = symbology
I went to arcpy.ListFields(lyr) and was able to easier differentiate between the different point layers.
act_map = aprx.activeMap
map = aprx.listMaps("Map1")
OPField = "xxxx"
for lyr in layers:
fieldList = arcpy.ListFields(lyr)
for field in fieldList:
if field.name == OPField:
symbology = lyr.symbology
symbology.updateRenderer("SimpleRenderer")
symbol = symbology.renderer.symbol
symbol.color = {"RGB": [169, 0, 230, 100]}
symbol.outlineColor = {"RGB": [0, 0, 0, 100]}
symbol.size = 6
lyr.symbology = symbology
As I commented to your question over at GIS SE: arcpy - Describe Field Name? - Geographic Information Systems Stack Exchange.
According to Field - ArcGIS Pro | Documentation, "Field properties can be accessed through the ListFields and Describe functions." If you already have a Describe object for a layer, e.g., desc = arcpy.Describe(layer), retrieving the fields property will return a list of Field objects: desc.fields.