In this article you will learn how to save Data Driven Pages or map collections generated in an ArcMap file to individual files using Python. No programming is required.
Once the Data Driven page feature is enabled you will be able to get multiple maps in PDF format from a single MXD file by following the steps listed below:
How to export maps to PDF with ArcGIS Data Driven Pages.
1) Open the MXD file with the Data Driven page enabled.
2) Go to File.
3) Click “Export Map...” in the displayed submenu.
4) In the Pages tab indicate the pages to be exported (a) and whether to save in a single PDF file or in several files (b).
5) In the General tab choose the File name (a), the file type (b) and the resolution (c). Then press the “Save” button (d).
However, if you would like to make a change in the layout of the elements on a specific Data Driven Page or pages there is no way to do so without modifying the rest of the pages that may be meeting your specifications; it may also be a technical requirement that each map be presented in its editable version. For this reason, I will show you how you can separate each of your pages into individual files so that you have more flexibility when presenting your maps or they can be presented separately to a client.
This is especially useful when the amount of pages is a lot according to your criteria; I must recognize that I have a lot of appreciation to this code that I am going to present to you because it saved my life when I had to present 1089 maps coming from the views of a Data Driven Page in ArcMap format, without this code my option was to pass each page and save each one with a different name, estimating 1 minute per page would have been 1089 minutes which represents 18 hours of work approximately and I only had 3 hours to achieve it and thanks to this code the time was reduced to 10 minutes.
I hope that with this anecdote you can see how useful will be for you this knowledge that I will transmit to you next. The sequence of steps to achieve this is as follows:
How to save Data Driven Pages views as separate files?
Step 1: Open the MXD file with the Data Driven Page enabled.
Step 2: Open the Python window in the Standard toolbar.
Step 3: Copy the following code into a notepad and replace the text C:\EJEMPLO in line #09 with the path to the folder where you want the MXD files to be saved.
Step 4: In line #10 of the code replace the word PREFIX with the prefix you want for the MXD files.
Step 5: In line #08 replace the word “PageNumber” with the name of the field used to name the pages of the Data Driven Page.
Step 6: Copy the modified code into the Python window and press the Enter key twice.
After a few seconds you will see the MXD files start to appear in the output folder indicated in line #09, and in this way you can automatically save the pages generated by the Data Driven Page from an MXD file into individual ArcGIS files.
I hope you enjoyed this article, soon I will upload a video explaining the procedure that you can consult in this blog. Save my blog among your favorite links, I will be uploading many more tricks of this style, remember that you can send me your concerns in the contact page or leave your comment, I will be attentive to respond.





