I am trying to standardize map export for some of my maps with ArcPy. In the ArcGIS interface, I would click FullExtent before exporting (File --> Export map), so that the full map is covered in the image file.

With ArcPy, I have not understood how this works. Currently, I use arcpy.mapping.ExportToJPEG to export the maps. When I then look at these images, however, they only show part of the map. How can I make sure ArcPy centers the map first such that the full extent of the maps is shown?

1 Answer 1


You can zoom to the full extent of all layers (which is usually the Map full extent) by using the Data Frame Zoom to Selected Features tool while nothing is selected.

zoomToSelectedFeatures ()

This performs the same ArcMap operation as Selection > Zoom To Selected Features. One difference is that if no features are selected, it will zoom to the full extent of all layers.

DataFrame - ArcGIS Desktop Help

mxd = arcpy.mapping.MapDocument("mymap.mxd")
df = mxd.activeDataFrame



If you have a defined Full Extent (rather than the extent of all layers) you can set the Data Frame extent and zoom to that

mxd = arcpy.mapping.MapDocument("mymap.mxd")
df = mxd.activeDataFrame

newExtent = df.extent
# Set your defined extent here
newExtent.XMin, newExtent.YMin = -180.0, -90.0 
newExtent.XMax, newExtent.YMax = 180.0, 90.0

# Zoom to the defined extent
df.extent = newExtent
  • One clarification question: Using your code, I can export the map to jpeg in full extent. This map then appears on a vertical DIN A4 page, even though it is rather horizontal (think of the borders of the US). Is it possible to export the maps in a "wide" format, too? Commented Mar 26, 2017 at 17:28
  • 1
    @eigenvector This sounds like a new question you should ask separately. Have you looked at changing your page layout and print settings in ArcMap to Landscape? Alternatively the Export to JPG too allows you to set output dimensions if you're not using a page layout, using output width and output height.
    – Midavalo
    Commented Mar 26, 2017 at 18:09
  • Yes, probably I should ask a new question for this. I will play around a bit with your tips to see if there is a quick solution and ask a new question if I cannot fix it. Thank you for the help. Commented Mar 26, 2017 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.