<?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: Legend issues with notebook script in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/legend-issues-with-notebook-script/m-p/1578748#M92280</link>
    <description>&lt;P&gt;Here are a couple screenshots if that helps. The legends are part of the Layers map frame. This was a layout from ArcMap that I imported into Pro and am trying to update my script.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jan 2025 17:22:30 GMT</pubDate>
    <dc:creator>JohnsonAbby</dc:creator>
    <dc:date>2025-01-24T17:22:30Z</dc:date>
    <item>
      <title>Legend issues with notebook script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/legend-issues-with-notebook-script/m-p/1578443#M92243</link>
      <description>&lt;P&gt;In the following script, it outputs the maps correctly but the legend keeps repeating itself between the first few county legends? I've attached an example for Sulfate by town-range and you can see the legend shows Arsenic by county.&lt;/P&gt;&lt;P&gt;# Make Web Display Current Map Set&lt;BR /&gt;# make sure only WI_Counties layer on&lt;BR /&gt;import sys&lt;BR /&gt;import arcpy&lt;BR /&gt;import os&lt;BR /&gt;import arcpy.mp as Map&lt;/P&gt;&lt;P&gt;# set these control parameters for the map production:&lt;BR /&gt;xDate = "January - 2025" # current data set being displayed (above legend on layout)&lt;BR /&gt;xPrint = "no" # "yes"/"no" for print control&lt;BR /&gt;xFormat = "pdf" # can be either pdf or png; reset the map document to a borderless png version if appropriate&lt;BR /&gt;xRes = 300&lt;BR /&gt;pdfBook = "Viewer_MapBook_January_2025" #enter name of mapbook; disabled when format set to png&lt;BR /&gt;xDir=r"C:\Projects\Well Water Quality Viewer\make_web\Display_Maps" #dir for the output files&lt;BR /&gt;aprxFile=r"C:\Projects\Well Water Quality Viewer\make_web\Display_Maps\Display_Maps\Display_Maps.aprx" #mxd document&lt;BR /&gt;# set maps to a list of desired maps (in the order requested for mapbook)&lt;BR /&gt;maps = ['Alkalinity-Co','Arsenic-Co','Arsenic-Max-Co','Atrazine Family-Co','Bacteria-Co','Chloride-Co',&lt;BR /&gt;'Conductivity-Co','Copper-Co','Iron-Co','Lead-Co','Manganese-Co','Nitrate-Co','Nitrate Exceedence-Co',&lt;BR /&gt;'pH-Co','Saturation Index-Co','Sulfate-Co','Total Hardness-Co',&lt;BR /&gt;'Alkalinity-TR','Arsenic-TR','Arsenic-Max-TR','Atrazine Family-TR','Bacteria-TR','Chloride-TR',&lt;BR /&gt;'Conductivity-TR','Copper-TR','Iron-TR','Lead-TR','Manganese-TR','Nitrate-TR','Nitrate Exceedence-TR',&lt;BR /&gt;'pH-TR','Saturation Index-TR','Sulfate-TR','Total Hardness-TR',&lt;BR /&gt;'Alkalinity-S','Arsenic-S','Arsenic-Max-S','Atrazine Family-S','Bacteria-S','Chloride-S',&lt;BR /&gt;'Conductivity-S','Copper-S','Iron-S','Lead-S','Manganese-S','Nitrate-S','Nitrate Exceedence-S',&lt;BR /&gt;'pH-S','Saturation Index-S','Sulfate-S','Total Hardness-S']&lt;BR /&gt;# ---------------------------------------------------------------&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;aprx = Map.ArcGISProject(aprxFile)&lt;BR /&gt;layout = aprx.listLayouts('PW_WEB_MAPPER')[0]&lt;BR /&gt;ms = layout.mapSeries&lt;BR /&gt;noteSet = layout.listElements("TEXT_ELEMENT", "Data_Set")[0]&lt;BR /&gt;noteSet.text = xDate&lt;BR /&gt;legendList = aprx.listMaps("Layers")[0]&lt;BR /&gt;dfList = aprx.listMaps("Layers")[0]&lt;/P&gt;&lt;P&gt;if xFormat != "pdf":&lt;BR /&gt;xPrint = "no"&lt;BR /&gt;if xPrint == "no":&lt;BR /&gt;mapPrint = "N"&lt;BR /&gt;else:&lt;BR /&gt;mapPrint = "P"&lt;BR /&gt;if xFormat != "pdf":&lt;BR /&gt;pdfBook = "no"&lt;BR /&gt;if pdfBook != "no":&lt;BR /&gt;pdfDoc = Map.PDFDocumentCreate(os.path.join(xDir, pdfBook)+".pdf")&lt;/P&gt;&lt;P&gt;#main loop&lt;BR /&gt;for xmap in maps:&lt;BR /&gt;curLayer = dfList.listLayers(xmap)[0]&lt;BR /&gt;#curLegend = legendList.listLayers(xmap)[0]&lt;BR /&gt;curLayer.visible = True&lt;BR /&gt;#curLegend.visible = True&lt;BR /&gt;Xport = os.path.join(xDir, xmap)&lt;BR /&gt;if xFormat == "pdf":&lt;BR /&gt;layout.exportToPDF(Xport,resolution=xRes)&lt;BR /&gt;if pdfBook != "no":&lt;BR /&gt;pdfDoc.appendPages(Xport+".pdf")&lt;BR /&gt;else:&lt;BR /&gt;layout.exportToPNG(Xport,resolution=xRes)&lt;BR /&gt;if mapPrint == "P":&lt;BR /&gt;Map.PrintMap(aprx)&lt;BR /&gt;print ("Exported: ", xmap)&lt;BR /&gt;curLayer.visible = False&lt;BR /&gt;curLegend.visible = False&lt;/P&gt;&lt;P&gt;if pdfBook != "no":&lt;BR /&gt;pdfDoc.saveAndClose()&lt;BR /&gt;del pdfDoc&lt;BR /&gt;del aprx&lt;BR /&gt;print ("Script Complete")&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2025 21:25:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/legend-issues-with-notebook-script/m-p/1578443#M92243</guid>
      <dc:creator>JohnsonAbby</dc:creator>
      <dc:date>2025-01-23T21:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Legend issues with notebook script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/legend-issues-with-notebook-script/m-p/1578739#M92276</link>
      <description>&lt;P&gt;Hello, I can't identify the issue from the picture that is attached.&amp;nbsp; What is "repeating itself"?&lt;/P&gt;&lt;P&gt;Jeff - arcpy.mp team&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 17:09:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/legend-issues-with-notebook-script/m-p/1578739#M92276</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2025-01-24T17:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Legend issues with notebook script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/legend-issues-with-notebook-script/m-p/1578740#M92277</link>
      <description>The legends for Alkalinity-co, arsenic-co and chloride-co keep repeating. There are 14 parameters each for county, town-range and section. So for sulfate it’s showing chloride rather than going through the list of legends. Does that help?&lt;BR /&gt;</description>
      <pubDate>Fri, 24 Jan 2025 17:13:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/legend-issues-with-notebook-script/m-p/1578740#M92277</guid>
      <dc:creator>JohnsonAbby</dc:creator>
      <dc:date>2025-01-24T17:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Legend issues with notebook script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/legend-issues-with-notebook-script/m-p/1578748#M92280</link>
      <description>&lt;P&gt;Here are a couple screenshots if that helps. The legends are part of the Layers map frame. This was a layout from ArcMap that I imported into Pro and am trying to update my script.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 17:22:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/legend-issues-with-notebook-script/m-p/1578748#M92280</guid>
      <dc:creator>JohnsonAbby</dc:creator>
      <dc:date>2025-01-24T17:22:30Z</dc:date>
    </item>
  </channel>
</rss>

