I have written a python script to batch export several pdfs from a single mxd, switching layers on/off and naming the output pdf based on values supplied by the user in a csv file. We import the required datasets into a template mxd I've set up containing pre-named groups and the company sidebar. The template has a large data frame in the centre of the page for the main data and a smaller "inset map" data frame in the sidebar below the legend to show the datasets' position relative to known geographic locations. The geographic location of the main data frame is shown in this inset map.

The issue we're having is that the first pdf export behaves as expected, but the inset map in the rest of the exports shows a larger "main data frame" extent than it should. I've attached two images to illustrate what we're seeing.

The python script is quite long (as it's part of a larger toolset script), but if you need to see it I can add it (though all it does is read a csv, switch layers on/off and export as pdf - no scaling or moving dataframes).

Do I need to refresh / regenerate some values before each export?

Correctly sized extent in inset map

Extent in inset map is larger despite no change in main data frame extents

closed as off-topic by PolyGeo Mar 23 '17 at 9:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.


I start the process from layout view, but the script automatically switches to data view to turn various layers on/off. The issue was caused by the difference in scale when switching between views (still odd that the map was correct, just not the extent indicator!). I've corrected the issue by noting the scale at the start of the script and forcing the switch back to layout view before exporting.

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