Exporting Data Driven Pages
Data Driven Pages give you the ability to generate a set of output pages by taking a single layout and iterating over a set of map extents. Once you've created a map with Data Driven Pages, you may want to export the pages to share with others. You could iterate through each page and create separate files in any export format supported by ArcGIS. However, a more common use case is to include all, or selected, pages in a single file. This is an easy way to share your map book or map series with others.
PDF is the only export format that supports multiple pages in a single document. Here is an example of a multipage map book:
Though much of this document consists of pages displaying a map, for example, pages 3 through 9, this PDF also contains pages that were not created using Data Driven Pages. These pages include the title page (1), the overview map page (2), and additional pages of ancillary information. To incorporate such pages into a PDF document, you need to use an arcpy.mapping script.
Exporting Data Driven Pages
You can use the Export Map dialog box to export Data Driven Pages to PDF. To export Data Driven Pages, two conditions must be met: Data Driven Pages must be enabled and the map document must be in layout view. You will get an error message if either of these two conditions is not true.
There are a number of ways to export Data Driven Pages. You can export all pages, only the current page, or selected pages based on selected index features or selected page numbers.
This option exports all the Data Driven Pages in your series. The total number of pages is reported in parentheses. Depending on the number of pages to export, this may take some time.
This option exports only the current page viewed in the map layout. The current page is always defined by the current index feature. If you interactively change the extent of the detail data frame and then try to export this new extent, you will not get the same result. The result will display the extent based on the index layer feature, not your interactive zoom. If you want to export a new extent, you must disable Data Driven Pages before exporting.
This is the default option when no index features are selected.
This option exports pages based on selected index features. The total number of selected pages is reported in parentheses. You select pages by selecting features of the index layer that drive the geographic extent of each page. You can select these features in any number of ways: interactively by using the Select Features tools, or through dialog boxes such as Select By Attribute or Select By Location.
For example, consider a Data Driven Pages map document where the index layer is US States. You only want to create a PDF for states with a population above 5,000,000. You can select these states, or index layer features, using the Select By Location dialog box, provided the layer has an attribute for population. Once these features are selected, you export the Data Driven Pages to a PDF using the Selected button. The result should be a series of map pages for U.S. states with a population over 5,000,000.
By default, exported Data Driven Pages will not include selection symbology in the PDF result. The result displays index features as if they were not selected. In cases where you do want to show selected features using selection symbology, you can check the Show Selection Symbology check box.
This is the default option if any index features are currently selected.
If you switched to data view in order to perform your selection, remember to switch back to layout view before exporting Data Driven Pages.
This option exports pages you specify, either individually or by range. You will receive an error if you mistakenly type a number outside the current range of pages. You can specify individual pages (3, 5, 8), ranges (1-4, 7-14), or a combination of the two (1, 4, 7-14). The pages will be exported in the order you specify them. For example, if you enter 9, 5–7, 2, page 9 will be exported first and page 2 will be exported last.
It is important to note that page on this dialog box refers to the page index as determined by the Data Driven Pages sorting logic. The index always starts with 1 and ends with the number of pages created. The sorting logic is defined by the Sort Field in the Data Driven Pages setup. Every set of Data Driven Pages is sorted, and Page Range mirrors this.
Data Driven Pages also allow you to define a page number. The page number can be based on field values of the index layer. These values can be alphanumeric. For example, you can use Roman numerals or numbers with dashes to number your pages. If you will be inserting pages between maps, you may be skipping page numbers as you populate this field. These page number field values can be used to drive dynamic text in the map layout. Page number may or may not be the same as page index.
For example, you want the first three pages in your map book to be for a title page, a table of contents, and an overview map. The maps (the results of the Data Driven Pages PDF export) actually begin on page 4. You want the first map in the Data Driven Pages series to display "Page 4" at the bottom of the layout page. This is the page number. Since this is the first map, the index number for this page is 1. If you want to export only this page using the Page Range text box, you would type 1.
Export Pages As
Use this option to control the merging of your pages into a single PDF file. The Multiple PDF Files option provides a way to create a separate PDF document for each page. To distinguish each PDF page, you can use page index or page name options. These will append either the current page index number or the current page name to the PDF document name. If you would prefer to merge pages and create a single PDF file with all pages contained inside, select the Single PDF File option instead.
How to export Data Driven Pages to PDF using ArcMap
- Verify that Data Driven Pages are enabled and that ArcMap is in layout view.
- Click File > Export Map from the main menu.
- Navigate to where you want to save the export file.
- Click the Save as type arrow and click PDF.
- Type a file name for the export file.
- Click the Pages tab.
- Choose what pages you want to export.
- Click Save.
How to export Data Driven Pages to other formats using ArcMap
You can use a simple arcpy.mapping script to export Data Driven Pages to formats other than PDF. This example shows how to export Data Driven Pages to a series of PNG image files.
- Verify that Data Driven Pages are enabled.
- Click Geoprocessing > Python from the main menu to open the Python Window
- Copy this script text to the clipboard and paste it into the Python Window:
mxd = arcpy.mapping.MapDocument("CURRENT") for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = pageNum arcpy.mapping.ExportToPNG(mxd, r"C:\Temp\ParcelAtlas_Page" + str(pageNum) + ".png") del mxd
- Modify the file path text C:\Temp\ParcelAtlas_Page so it matches the folder location and file name you want.
- After modifying the script text as needed, click on the bottom line of the Python Window to move the text insertion cursor to the end of the script.
- Press the ENTER key to execute the script and export the pages.
For a complete list of the export functions available in arcpy.mapping, see the Alphabetical list of arcpy.mapping functions