Select to view content in your preferred language

Add feature to current APRX and Map in PRO?

889
2
Jump to solution
10-14-2019 06:36 PM
deleted-user-yC5VkbyXzrQR
Deactivated User

Is there a way to add a feature to the current MAP that is open in Pro, in a stand alone script? 

I know the below code adds it to the first map. 

But what if I want to add it to whatever map I have opened? 

The other option is to create a new map in the CURRENT APRX and add the features there. It would be more user friendly if it could add it to the map that you are currently on. 

aprx = arcpy.mp.ArcGISProject("CURRENT")
mp = aprx.listMaps()[0]


mp.addDataFromPath(fgdb + "\\" + e + "_buffer")

Regards, 

Adam 

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

ArcGISProject—ArcPy | ArcGIS Desktop 

activeMap???

activeMap
(Read Only)

Returns the map object associated with the focused view within the application. None will be returned if there are no views open that have an associated map or when a script is run outside of the application.

View solution in original post

2 Replies
DanPatterson_Retired
MVP Emeritus

ArcGISProject—ArcPy | ArcGIS Desktop 

activeMap???

activeMap
(Read Only)

Returns the map object associated with the focused view within the application. None will be returned if there are no views open that have an associated map or when a script is run outside of the application.

deleted-user-yC5VkbyXzrQR
Deactivated User

Thanks Dan! 
I feel like I owe you something, always answering. 

Do you go to the Dev Summit in March ?  

0 Kudos