Equivalent of df = mxd.activeDataFrame in ArcGIS Pro?

3233
9
Jump to solution
04-14-2016 03:30 PM
MarcoBoeringa
MVP Regular Contributor

Hi everyone,

I have wondered if there is currently an equivalent of df = mxd.activeDataFrame in ArcGIS Pro? I can't find anything up to now. I would have expected something like aprx.activeMap, but that doesn't exist on the ArcGISProject object.

activeDataFrame is such a crucial tool in working with arcpy in ArcMap, that I am slightly stumped to see no obvious equivalent in Pro. Yes, you can use listMaps to get to the maps, but that doesn't tell you anything about which one is currently active / in front view.

Of course, with multiple possible maps and layouts, there may also be a layout "active", but there should be ways to deal with that. Maybe a more generic aprx.activeFrame? ... with some possibility to test what type it is.

Anyway, is there anything I missed?

0 Kudos
1 Solution

Accepted Solutions
KoryKramer
Esri Community Moderator

Marco Boeringa‌ Yes, looks like it is in 2.1

View solution in original post

9 Replies
JoshuaBixby
MVP Esteemed Contributor

A similar question was asked a few days ago, Calling "Current" layout name in Arcpy​.  The functionality you seek hasn't been implemented yet in arcpy.mp.

MarcoBoeringa
MVP Regular Contributor

Thanks, that was what I was already afraid of. Hope ESRI will add something in a future version. Otherwise, all arcpy tools being upgraded from ArcMap, and using mxd.activeDataFrame, will likely need an additional "Map" parameter to allow user to set the appropriate map, as there is no real way from arcpy to get it.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Of all the ArcPy-related changes between ArcMap/ArcCatalog and ArcGIS Pro, the Mapping module has the most ground to cover since it deals with the UI and that is completely different between the two products.  There are still plenty of mapping and cartographic features, outside of ArcPy, that haven't made it into Pro yet.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Marco  What is ArcPy?—ArcPy Get Started | ArcGIS for Desktop  is your best guide for now, they are going back old school (aprx etc and multiple layouts ... hmmmm sounds familiar) and moving functionality out of arccatalog back into arcmap and as pointed out, mp is the latest change, but other than providing a terminology comparison, esri hasn't provided an arcpy comparison matrix... a good task for someone with spare time

0 Kudos
MarcoBoeringa
MVP Regular Contributor

Dan, I know, I have read through these pages dozens of times in search for different types of functionality and code examples that I needed for the conversion I was working on. In fact, I have succeeded in making my ArcGIS Renderer for OpenStreetMap "future prove" by re-writing parts of the code to be both Python 2.7/.3x compatible, and ArcMap / ArcGIS Pro compatible. I now have one advanced toolbox that can run both in ArcMap and Pro. That was no small feat, because it required quite some minor and major adjustements, only part of which could be deducted or was documented in the Pro Help pages like Python migration for ArcGIS Pro—ArcPy Get Started | ArcGIS for Desktop

This is just one of those last minor hurdles or annoyances that I can live with, but it would be nice to see a better support in Pro. Like Joshua wrote, we probably just need to be a bit more patient for ESRI to catch up in Pro.

DanPatterson_Retired
MVP Emeritus

I liked the old object model that used to appear (not the arcobjects monster)... that would be a nice addititon

0 Kudos
MarcoBoeringa
MVP Regular Contributor

Does anyone know if Pro 2.1 will finally implement something like this? As far as I can see, the current Pro 2.0 Help still doesn't list any equivalent function to the mxd.activeDataFrame of ArcMap, so you never know which Pro map is actually the one being actively used by the user from arcpy perspective...

This is fuctionality that is highly desirable for arcpy development and certain workflows.

KoryKramer
Esri Community Moderator

Marco Boeringa‌ Yes, looks like it is in 2.1

MarcoBoeringa
MVP Regular Contributor

Thanks @Kory Kramer. This is great to hear and will be really useful for Python script development.