How to get Map ID (Number?)

1153
5
Jump to solution
06-25-2019 11:39 AM
ThomasColson
MVP Frequent Contributor

I'm thinking of using https://www.esri.com/arcgis-blog/products/analytics/analytics/updating-your-hosted-feature-services-... to automate my feature services from one project, instead of a separate project for each service. mp = prj.listMaps()[0] is what tells it to use the first map in the project. 

How does one find the Map # in a project with hundreds of maps? Say I want to publish the 30th map in the project. 

Python is only outputting

prjPath = r"X:\GIS_Final\data\basedata\basemap\Maps\ArcGIS\ARCGIS_SERVER\GRSM_SPECIAL_USE_PERMITS\GRSM_SPECIAL_USE_PERMITS.aprx"
prj = arcpy.mp.ArcGISProject(prjPath)
mp = prj.listMaps()
mp
[<arcpy._mp.Map object at 0x000002560D31BDD8>]
mp = prj.listMaps
mp
<bound method ArcGISProject.listMaps of <arcpy._mp.ArcGISProject object at 0x00000256089FDFD0>>
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MatthewDriscoll
MVP Alum

Just add in the name of the map.

mp = prj.listMaps("MapName")[0]

View solution in original post

5 Replies
MatthewDriscoll
MVP Alum

Just add in the name of the map.

mp = prj.listMaps("MapName")[0]
ThomasColson
MVP Frequent Contributor

I spoke too soon....

0 Kudos
ThomasColson
MVP Frequent Contributor

So here's what's going on. Despite the clear existence of the 3 maps...

0 Kudos
MatthewDriscoll
MVP Alum

Interesting that the print leaves out anything after "PERMITS".  Perhaps a Map cannot be named so many characters long or something?

0 Kudos
MatthewDriscoll
MVP Alum

You might want to call technical support.  I just tried this about 20 times using your naming and some others and I was able to replicate it the same problem.  However it only happened a few of the times, which was strange.  I did nothing different when those few failed.  Maybe a bug.  Sorry I don't have more for you. 

0 Kudos