<?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 Different legend behavior using arcpy and ArcGIS Pro in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/different-legend-behavior-using-arcpy-and-arcgis/m-p/1385266#M79145</link>
    <description>&lt;P&gt;I am creating a tool using arcpy to get a web map as json and print it through a layout template. I could get the aprx through the code snippet below, but the tool's outcome legend differs from ArcGIS Pro as shown in the images. The problem happens when there is a group layer as well as labels for sub-items. So the legend doesn't include second group layer names and instead makes duplicate labels for sub-items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;result = arcpy.mp.ConvertWebMapToArcGISProject(webmap_json, layout_template, "Layers Map Frame")
aprx = result.ArcGISProject
layout = aprx.listLayouts()[0]
layout.exportToPDF(out_pdf=output)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Output from the tool with duplicate labels&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%"&gt;The actual layer in ArcGIS Pro&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tool.PNG" style="width: 383px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95449i29885329D3BB1891/image-size/large?v=v2&amp;amp;px=999" role="button" title="tool.PNG" alt="tool.PNG" /&gt;&lt;/span&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="arc.PNG" style="width: 293px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95452i92ED0705579A3B90/image-size/large?v=v2&amp;amp;px=999" role="button" title="arc.PNG" alt="arc.PNG" /&gt;&lt;/span&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV&gt;I tried to get the aprx file and save it. the created aprx file has this wired behavior of duplicating labels/layer names on printing legend too when I want to use a sample layout. I have also attached the settings for the legend part of the layout. I checked different settings scenarios with &lt;STRONG&gt;Group layer name&lt;/STRONG&gt;, &lt;STRONG&gt;layer name&lt;/STRONG&gt; and &lt;STRONG&gt;Label.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="settings.PNG" style="width: 316px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95451iED07C7BD66EA95FE/image-size/large?v=v2&amp;amp;px=999" role="button" title="settings.PNG" alt="settings.PNG" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV&gt;Any help or hint would be appreciated.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;ArcGIS pro version: 2.6&lt;/DIV&gt;</description>
    <pubDate>Thu, 22 Feb 2024 04:29:29 GMT</pubDate>
    <dc:creator>gisman33</dc:creator>
    <dc:date>2024-02-22T04:29:29Z</dc:date>
    <item>
      <title>Different legend behavior using arcpy and ArcGIS Pro</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/different-legend-behavior-using-arcpy-and-arcgis/m-p/1385266#M79145</link>
      <description>&lt;P&gt;I am creating a tool using arcpy to get a web map as json and print it through a layout template. I could get the aprx through the code snippet below, but the tool's outcome legend differs from ArcGIS Pro as shown in the images. The problem happens when there is a group layer as well as labels for sub-items. So the legend doesn't include second group layer names and instead makes duplicate labels for sub-items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;result = arcpy.mp.ConvertWebMapToArcGISProject(webmap_json, layout_template, "Layers Map Frame")
aprx = result.ArcGISProject
layout = aprx.listLayouts()[0]
layout.exportToPDF(out_pdf=output)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Output from the tool with duplicate labels&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%"&gt;The actual layer in ArcGIS Pro&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tool.PNG" style="width: 383px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95449i29885329D3BB1891/image-size/large?v=v2&amp;amp;px=999" role="button" title="tool.PNG" alt="tool.PNG" /&gt;&lt;/span&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="arc.PNG" style="width: 293px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95452i92ED0705579A3B90/image-size/large?v=v2&amp;amp;px=999" role="button" title="arc.PNG" alt="arc.PNG" /&gt;&lt;/span&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV&gt;I tried to get the aprx file and save it. the created aprx file has this wired behavior of duplicating labels/layer names on printing legend too when I want to use a sample layout. I have also attached the settings for the legend part of the layout. I checked different settings scenarios with &lt;STRONG&gt;Group layer name&lt;/STRONG&gt;, &lt;STRONG&gt;layer name&lt;/STRONG&gt; and &lt;STRONG&gt;Label.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="settings.PNG" style="width: 316px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95451iED07C7BD66EA95FE/image-size/large?v=v2&amp;amp;px=999" role="button" title="settings.PNG" alt="settings.PNG" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV&gt;Any help or hint would be appreciated.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;ArcGIS pro version: 2.6&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Feb 2024 04:29:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/different-legend-behavior-using-arcpy-and-arcgis/m-p/1385266#M79145</guid>
      <dc:creator>gisman33</dc:creator>
      <dc:date>2024-02-22T04:29:29Z</dc:date>
    </item>
  </channel>
</rss>

