Select to view content in your preferred language

open/activate map with arcpy

1711
3
08-03-2023 11:40 PM
Status: Already Offered
Labels (1)
nadja
by
Frequent Contributor

A simple yet powerful method in ArcPy is missing: opening/activating an existing map. 

It is possible to add a new map (newMap = aprx.createMap("Map")) and it is also possible to get the (last) active maps (aprx = arcpy.mp.ArcGISProject("current") //active_map = aprx.activeMap). 

What's missing is a method to not only replace the "activeMap" in the code, but also to open/activate that map, so that it is displayed in the map view window. To activate a map in the code it would need a method like "Mapname.activate()" which overwrites the previous"activeMap". Since normally the active map is the last used map in the map view window (the big part in the middle of the screen), the anticipated method "activate()" would also need to add that activated map. 

I could think of many cases where this method could be used.

Tags (4)
3 Comments
JeffBarrette

@nadja Have you tried:

Map.openView()?  It opens a view for the map objects AND activates it.  This works for Layout and Reports too.

We also have ArcGISProject.closeViews()

Jeff - Layout and arcpy.mp teams

nadja
by

@JeffBarrette no - thank you, that's exactly what I meant 🙂 I leave the idea, in case anyone else has trouble finding the documentation...

JeffBarrette
Status changed to: Already Offered

Map.openView() was what needed.