Creating a tool using Python to get existing maps within Pro to zoom to a specific coordinate.

491
0
12-31-2020 09:41 AM
Labels (1)
aarkowitz_BLM
New Contributor

I am trying to get an existing 'map' within an Arc Pro project to zoom into a set of specific (preferably user defined) coordinates or even a shapefile every time the map is opened within the Pro project or added as a frame to a layout.  Again, the 'extent' will vary for each user, so make that a variable. I am using ArcPro 2.5

I have gotten this so far but it does not allow for a used defined extent and may not work on unopened aprx files/maps.

 

aprx = arcpy.mp.ArcGISProject('current')

mv = aprx.activeView

ext = mv.camera.getExtent()

ext.XMin = ext.XMin + 100

ext.YMin = ext.YMin + 100

ext.XMax = ext.XMax – 100

ext.YMax = ext.YMax - 100

mv.camera.setExtent(ext)

0 Kudos
0 Replies