<?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 Re: Customize Pro UI: Checkboxes in TOC to toggle symbol classes in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/customize-pro-ui-checkboxes-in-toc-to-toggle/m-p/1239697#M9161</link>
    <description>&lt;P&gt;Oh, that's just unfortunate naming of the variable.&lt;/P&gt;&lt;P&gt;Despite me calling the variable &lt;EM&gt;query_layer&lt;/EM&gt;, I'm &lt;STRONG&gt;not&lt;/STRONG&gt; using &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-query-layer.htm" target="_blank" rel="noopener"&gt;Make Query Layer&lt;/A&gt; (which, correct, can only be used with an Enterprise gdb).&lt;/P&gt;&lt;P&gt;Instead, I'm using &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-feature-layer.htm" target="_blank" rel="noopener"&gt;Make Feature Layer&lt;/A&gt;, which takes an optional where clause and can be used with all feature sources (fgdb, egdb, feature service, shape file, ...). It basically creates a new layer and sets its definition query.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Dec 2022 16:29:58 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-12-09T16:29:58Z</dc:date>
    <item>
      <title>Customize Pro UI: Checkboxes in TOC to toggle symbol classes</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/customize-pro-ui-checkboxes-in-toc-to-toggle/m-p/1239125#M9156</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Is there a way to add checkboxes to the layer symbology in the Table of Contents &amp;nbsp;— to toggle symbology classes on and off?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1670507450501.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/57956iC9F4DF3BDAB600BE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1670507450501.png" alt="Bud_0-1670507450501.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Maybe the underlying mechanism would be an automatically-generated display filter?&lt;/P&gt;&lt;PRE&gt;SQL Expression:&lt;BR /&gt;&lt;BR /&gt;AND (&amp;lt;symbology class value field&amp;gt; IN (45,46,47,48))&lt;/PRE&gt;&lt;P&gt;Is that kind of thing possible? Is&amp;nbsp;the Pro SDK the right mechanism?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 16:42:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/customize-pro-ui-checkboxes-in-toc-to-toggle/m-p/1239125#M9156</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-12-08T16:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Customize Pro UI: Checkboxes in TOC to toggle symbol classes</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/customize-pro-ui-checkboxes-in-toc-to-toggle/m-p/1239558#M9159</link>
      <description>&lt;P&gt;No idea about the SDK, but you can convert the layer to multiple query layers:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def convert_unique_symbol_layer_to_query_layers(layer_name):
    # get the symbology fields and items
    layer = arcpy.mp.ArcGISProject("current").activeMap.listLayers(layer_name)[0]
    renderer = layer.symbology.renderer
    fields = renderer.fields
    items = renderer.groups[0].items
    # loop over the items
    for item in reversed(items):
        # create the query layer
        values = item.values[0]
        query = " AND ".join([f"{fields[i]} = '{values[i]}'" for i in range(len(fields))])
        print(f"Creating query layer {item.label} with query {query}")
        query_layer = arcpy.management.MakeFeatureLayer(layer, item.label, query)[0]
        # change the symbology
        symbology = query_layer.symbology
        symbology.updateRenderer("SimpleRenderer")
        symbology.renderer.symbol = item.symbol
        query_layer.symbology = symbology


convert_unique_symbol_layer_to_query_layers("Bauwerke")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1670582773260.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58094i6B5A5A39C740A4AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1670582773260.png" alt="JohannesLindner_0-1670582773260.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_1-1670582845335.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58095i98AB653EA0A4EBC1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_1-1670582845335.png" alt="JohannesLindner_1-1670582845335.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't found a way to apply symbol rotation with arcpy, so that's a smallish problem for point layers&amp;nbsp; (eg the "Brücke" layer).&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 10:54:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/customize-pro-ui-checkboxes-in-toc-to-toggle/m-p/1239558#M9159</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-12-09T10:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Customize Pro UI: Checkboxes in TOC to toggle symbol classes</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/customize-pro-ui-checkboxes-in-toc-to-toggle/m-p/1239567#M9160</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;That’s useful.&lt;/P&gt;&lt;P&gt;Out of curiosity, what was you reasoning for using query layers (enterprise GDBs-only) vs. generic TOC feature layers (datatype-agnostic)?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 16:37:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/customize-pro-ui-checkboxes-in-toc-to-toggle/m-p/1239567#M9160</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-12-09T16:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Customize Pro UI: Checkboxes in TOC to toggle symbol classes</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/customize-pro-ui-checkboxes-in-toc-to-toggle/m-p/1239697#M9161</link>
      <description>&lt;P&gt;Oh, that's just unfortunate naming of the variable.&lt;/P&gt;&lt;P&gt;Despite me calling the variable &lt;EM&gt;query_layer&lt;/EM&gt;, I'm &lt;STRONG&gt;not&lt;/STRONG&gt; using &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-query-layer.htm" target="_blank" rel="noopener"&gt;Make Query Layer&lt;/A&gt; (which, correct, can only be used with an Enterprise gdb).&lt;/P&gt;&lt;P&gt;Instead, I'm using &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-feature-layer.htm" target="_blank" rel="noopener"&gt;Make Feature Layer&lt;/A&gt;, which takes an optional where clause and can be used with all feature sources (fgdb, egdb, feature service, shape file, ...). It basically creates a new layer and sets its definition query.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 16:29:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/customize-pro-ui-checkboxes-in-toc-to-toggle/m-p/1239697#M9161</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-12-09T16:29:58Z</dc:date>
    </item>
  </channel>
</rss>

