Hi,
In ArcObjects, it's possible to retrieve the collections of IMaps in an MXD and retrieve the layers for each one. In ArcGIS Pro SDK, I only see a MapView.Active property for retrieving just the active MapView and its corresponding Map (and layers). Is there a way to retrieve all the MapViews or all the Maps in a project?
Thanks,
Martin
Hi
Here are some snippets that could help you to get this information in Pro:
1.Get the Unique List of Maps From the Map Panes
2.Gets all the "MapProjectItems"
Specifically, here are the code snippets -
Get the map panes (map views):
var mapPanes = ProApp.Panes.OfType<IMapPane>()
.GroupBy((mp) => mp.MapView.Map.URI).Select(grp => grp.FirstOrDefault());
Get all the map project items (maps in project):
IEnumerable<MapProjectItem> newMapItemsContainer = project.GetItems<MapProjectItem>();
await QueuedTask.Run(() =>
{
foreach (var mp in newMapItemsContainer)
{
//Do Something with the map. For Example:
Map myMap = mp.GetMap();
}
});
Thanks
Uma
Hi Uma,
Great thanks. I hadn't seen those snippets. It's clear now.
Martin