<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Combining symbol classes using Arcpy in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/combining-symbol-classes-using-arcpy/m-p/1290557#M69310</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to write a test script which looks at a layers attributes and then applies different colours based on a given attribute. This is the script I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

aprx = arcpy.mp.ArcGISProject("CURRENT")
aprxMap = aprx.activeMap
lyr = aprxMap.listLayers('Q_ARCHAEOLOGY')[0]
sym = lyr.symbology


sym.updateRenderer('UniqueValueRenderer')
sym.renderer.fields = ['LAYER_NAME']
for grp in sym.renderer.groups:
    for itm in grp.items:
        attrVal = itm.values[0][0]

        if attrVal == "ARCH_LAYER":
            itm.symbol.color = {"RGB": [249, 30, 22, 100]}      # red
            itm.symbol.outlineColor = {"RGB": [0, 0, 0, 0]}     # null colour for symbol outline
            itm.symbol.size = 5
            itm.label = str("layer")
        elif attrVal == "ARCH_PRE_EX":
            itm.symbol.color = {"RGB": [78, 247, 30, 100]}      # green
            itm.symbol.outlineColor = {"RGB": [0, 0, 0, 0]}     # null colour for symbol outline
            itm.symbol.size = 5
            itm.label = str("preex")
        elif attrVal == "ARCH" or attrVal == "ARCHAEOL":
            itm.symbol.color = {"RGB": [70, 207, 50, 100]}      # green
            itm.symbol.outlineColor = {"RGB": [0, 0, 0, 0]}     # null colour for symbol outline
            itm.symbol.size = 5
            itm.label = str("arch")


lyr.symbology = sym

aprx.save()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whilst for the most part this script works the issue I have is that it creates two symbol classes labelled "arch", whilst I want the attributes ARCH and ARCHAEOL combined into one symbol class for the purpose of legend tidiness on figures.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I combine these into one class? Is there a way replicate an Arcade expression combining the two in python?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 18 May 2023 08:01:39 GMT</pubDate>
    <dc:creator>OllyD</dc:creator>
    <dc:date>2023-05-18T08:01:39Z</dc:date>
    <item>
      <title>Combining symbol classes using Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/combining-symbol-classes-using-arcpy/m-p/1290557#M69310</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to write a test script which looks at a layers attributes and then applies different colours based on a given attribute. This is the script I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

aprx = arcpy.mp.ArcGISProject("CURRENT")
aprxMap = aprx.activeMap
lyr = aprxMap.listLayers('Q_ARCHAEOLOGY')[0]
sym = lyr.symbology


sym.updateRenderer('UniqueValueRenderer')
sym.renderer.fields = ['LAYER_NAME']
for grp in sym.renderer.groups:
    for itm in grp.items:
        attrVal = itm.values[0][0]

        if attrVal == "ARCH_LAYER":
            itm.symbol.color = {"RGB": [249, 30, 22, 100]}      # red
            itm.symbol.outlineColor = {"RGB": [0, 0, 0, 0]}     # null colour for symbol outline
            itm.symbol.size = 5
            itm.label = str("layer")
        elif attrVal == "ARCH_PRE_EX":
            itm.symbol.color = {"RGB": [78, 247, 30, 100]}      # green
            itm.symbol.outlineColor = {"RGB": [0, 0, 0, 0]}     # null colour for symbol outline
            itm.symbol.size = 5
            itm.label = str("preex")
        elif attrVal == "ARCH" or attrVal == "ARCHAEOL":
            itm.symbol.color = {"RGB": [70, 207, 50, 100]}      # green
            itm.symbol.outlineColor = {"RGB": [0, 0, 0, 0]}     # null colour for symbol outline
            itm.symbol.size = 5
            itm.label = str("arch")


lyr.symbology = sym

aprx.save()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whilst for the most part this script works the issue I have is that it creates two symbol classes labelled "arch", whilst I want the attributes ARCH and ARCHAEOL combined into one symbol class for the purpose of legend tidiness on figures.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I combine these into one class? Is there a way replicate an Arcade expression combining the two in python?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 08:01:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/combining-symbol-classes-using-arcpy/m-p/1290557#M69310</guid>
      <dc:creator>OllyD</dc:creator>
      <dc:date>2023-05-18T08:01:39Z</dc:date>
    </item>
  </channel>
</rss>

