Select to view content in your preferred language

Using arcpy to pan across map's data frame

1447
3
03-28-2019 02:31 PM
Kevin_C
Occasional Contributor

I have a total of 150 maps I used arcpy and the Mapping module to create. Everything works and looks fine, except that some maps have features being hidden by an inset data frame. I cannot change the position of the inset data frame, so that's out of the question. Is there a way using arcpy and the mapping module to pan across the map? 

Tags (3)
0 Kudos
3 Replies
PavanYadav
Esri Contributor

I wonder if this post: Zoom/Pan to layer using Arcpy 
or a combination of the above and the following example, can help you:

df = arcpy.mapping.ListDataFrames(mxd)[0]
newExtent = df.extent
newExtent.XMin, newExtent.YMin = -180.0, -90.0
newExtent.XMax, newExtent.YMax = 180.0, 90.0
df.extent = newExtent
Pavan Yadav
Product Engineer at Esri
AI for Imagery
Connect with me on LinkedIn!
Contact Esri Support Services
PavanYadav
Esri Contributor

Also, check this out: panToExtent (extent)

 

Pavan Yadav
Product Engineer at Esri
AI for Imagery
Connect with me on LinkedIn!
Contact Esri Support Services
JimCousins
MVP Regular Contributor

I use a bit of python script and pointers to bookmarks to output maps:

for bkmk in arcpy.mapping.ListBookmarks(mxd, data_frame=df):
      
    LookupText1 = bkmk.name
    df.extent = bkmk.extent
    arcpy.AddMessage(bkmk)
    arcpy.RefreshActiveView()

Let me know if you need some more information on how to do this.

Best Regards,

Jim