<?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: Why does calling listMaps() return multiples of the same maps in an ArcGIS Pro Project? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128564#M63329</link>
    <description>&lt;P&gt;First I would check the catalog pane to see what you have under "maps"' some map can exists without an existing tab.&lt;/P&gt;&lt;P&gt;By best guess is that your aprx is corrupted. You should be able to copy the maps you need to a clean aprx.&lt;/P&gt;&lt;P&gt;Have fun&lt;/P&gt;</description>
    <pubDate>Thu, 23 Dec 2021 06:13:39 GMT</pubDate>
    <dc:creator>mody_buchbinder</dc:creator>
    <dc:date>2021-12-23T06:13:39Z</dc:date>
    <item>
      <title>Why does calling listMaps() return multiples of the same maps in an ArcGIS Pro Project?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128506#M63324</link>
      <description>&lt;P&gt;I'm using ArcPy to iterate through maps in a Pro project. I have only one map in the Project called "Mines".&lt;/P&gt;&lt;P&gt;However, when I use listMaps to iterate through the maps in the aprx, it returns two values called "Mines". Any ideas why this is? Furthermore, if I list all the layers in each "Mines" map, the layers are slightly different. The first Mines map in the list contains layers that I actually deleted from the Pro Project, but the second one doesn't have this problem. And yes, I saved the Pro Project.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject(path_to_project)
for mp in aprx.listMaps("Mines"):
     print(mp.name)&lt;/LI-CODE&gt;&lt;P&gt;Really strange. Someone tell me I'm not in the Twilight Zone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 23:18:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128506#M63324</guid>
      <dc:creator>KevinCheriyan</dc:creator>
      <dc:date>2021-12-22T23:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why does calling listMaps() return multiples of the same maps in an ArcGIS Pro Project?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128509#M63325</link>
      <description>&lt;P&gt;Have you tried using 'CURRENT' instead of the variable/path to your project? Obviously this won't work when the app isn't open, but it might point to where the issue is occurring.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 23:58:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128509#M63325</guid>
      <dc:creator>jamesw</dc:creator>
      <dc:date>2021-12-22T23:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why does calling listMaps() return multiples of the same maps in an ArcGIS Pro Project?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128523#M63327</link>
      <description>&lt;P&gt;works for me outside of Pro&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
pth = r"C:\arcpro_npg\npg\Project_npg\npGeom.aprx"
aprx = arcpy.mp.ArcGISProject(pth)
# -- no limits
for i, m in enumerate(aprx.listMaps()):
    print(f"{i} : {m.name}")
0 : npgeom tests
1 : Odd_concave
... snip
17 : Map1
18 : Dissolve
19 : sq tests

# -- wildcard limit
pth = r"C:\arcpro_npg\npg\Project_npg\npGeom.aprx"
for i, m in enumerate(aprx.listMaps("Map1")):
    print(f"{i} : {m.name}")

0 : Map1
# -- another one
for i, m in enumerate(aprx.listMaps("Map*")):
    print(f"{i} : {m.name}")
    
0 : Map
1 : Map1&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 23 Dec 2021 01:56:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128523#M63327</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-23T01:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why does calling listMaps() return multiples of the same maps in an ArcGIS Pro Project?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128564#M63329</link>
      <description>&lt;P&gt;First I would check the catalog pane to see what you have under "maps"' some map can exists without an existing tab.&lt;/P&gt;&lt;P&gt;By best guess is that your aprx is corrupted. You should be able to copy the maps you need to a clean aprx.&lt;/P&gt;&lt;P&gt;Have fun&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 06:13:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128564#M63329</guid>
      <dc:creator>mody_buchbinder</dc:creator>
      <dc:date>2021-12-23T06:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Why does calling listMaps() return multiples of the same maps in an ArcGIS Pro Project?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128671#M63335</link>
      <description>&lt;P&gt;No other maps exist in catalog pane. I think the issue is somehow connected to the fact that this Pro project was created from a map package file. Somehow that created duplicate maps that I can't see listed in the tabs or catalog pane.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 16:51:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128671#M63335</guid>
      <dc:creator>KevinCheriyan</dc:creator>
      <dc:date>2021-12-23T16:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why does calling listMaps() return multiples of the same maps in an ArcGIS Pro Project?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128672#M63336</link>
      <description>&lt;P&gt;This is good advice. Instead of working from VS Code, I opened up the Pro Project's Python IDE. I then renamed the other nonactive maps to something else, so that I can access the true "Mines" map from the Project.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 16:54:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128672#M63336</guid>
      <dc:creator>KevinCheriyan</dc:creator>
      <dc:date>2021-12-23T16:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why does calling listMaps() return multiples of the same maps in an ArcGIS Pro Project?</title>
      <link>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128680#M63337</link>
      <description>&lt;P&gt;Not sure why exactly this is happening, but I reckon this might have something to do with the fact that the Pro Project was created from a map package (.mpk) file, instead of adding layers to a blank Project's map. Regardless of why it happens, this is how I solved it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a Python Notebook from within the Pro Project, I looped through the list of maps in the current Project and renamed the maps that are not active maps to have names other than "Mines". This allows my script that I wrote to access the single map named "Mines" which is what I wanted. Here's the code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")
for mp in aprx.listMaps():
    if mp != aprx.activeMap:
        mp.name = "OTHER"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 23 Dec 2021 17:06:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-calling-listmaps-return-multiples-of-the/m-p/1128680#M63337</guid>
      <dc:creator>KevinCheriyan</dc:creator>
      <dc:date>2021-12-23T17:06:38Z</dc:date>
    </item>
  </channel>
</rss>

