Using arcpy to pan across map's data frame

1186
3
03-28-2019 02:31 PM
Kevin_C
New Contributor III

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
PavanYadav
Esri Contributor

Also, check this out: panToExtent (extent)

 

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