Creating Data Driven Pages
Data Driven Pages gives you the ability to generate a set of output pages by taking a single layout and iterating over a set of map extents. The extents are defined by the features in a layer and are sometimes called tiles, sections, or areas of interest (AOI). The layer that defines the extents is referred to as an index layer. Any feature layer may serve as the index layer. You create and customize new Data Driven Pages using the Setup Data Driven Pages dialog box. This dialog box contains two tabs: Definition and Extent. You can activate this dialog box from the Data Driven Pages toolbar or from the Page and Print Setup dialog box.
Setup Data Driven Pages dialog box
Through the Definition tab, you can select the index layer that drives the geographic extent for each page. You can also choose fields to use to name and sort the pages. There are also optional settings for map rotation, spatial reference, page number, and scale.
Enabling Data Driven Pages
The Enable Data Driven Pages check box enables Data Driven Pages for the current map document. Unchecking the check box disables Data Driven Pages functionality. This check box needs to be checked to create, view, and utilize Data Driven Pages. If you disable Data Driven Pages and click OK, all Data Driven Pages settings you made are cleared. Data Driven Pages utilize the default settings the next time you enable Data Driven Pages for this map document.
Required elements for Data Driven Pages
Four elements are required for the creation of Data Driven Pages. They are
- Detail Data Frame
- Index Layer
- Name Field
- Sort Field
Detail Data Frame
To create a series of Data Driven Pages, select a data frame from the Data Frame drop-down menu. The default Data Frame for Data Driven Pages is the active data frame. Only a single data frame can be selected as the main data frame. The map extent of the main data frame changes for each page in the Data Driven Pages series. These map extents are driven by the spatial extent of features within the index layer.
This drop-down menu displays a list of data frames in the current map document. The map document may contain a single data frame or a number of data frames. Only one data frame can be selected for Data Driven Pages. This is the Detail Data Frame. You can choose any data frame in your map as the Detail Data Frame (as long as there is at least one layer in it).
Index Layer
To create a series of Data Driven Pages, select the index layer from the Layer drop-down list. The default index layer is the topmost polygon layer of the active data frame. The index layer defines the geographic extent of the main data frame for each page in the Data Driven Pages series. Each feature in the index layer drives, or defines, each page in the Data Driven Pages series. The geographic extent of the feature helps define the map extent of the Detail Data Frame for the page (this extent can be further customized on the Extent tab). Attributes of the index layer provide values for other Data Driven Pages parameters.
This drop-down menu displays a list of layers from Detail Data Frame. You can choose any feature layer from the Detail Data Frame for the index layer, as long as there is at least one feature in the layer. You are not confined to using only polygon layers as the index layer. You can also use points and lines, as long as you use a feature layer. Nonfeature layers, such as raster layers, cannot be used for the index layer. There are two geoprocessing tools available from the Data Driven Pages toolset in the Cartography toolbox to help you create an index layer: Grid Index Features and Strip Map Index Features.
When using point features, if you want to use only one map scale for each page, choose the Center and Maintain Current Scale option. Then, after exiting the Setup Data Driven Pages dialog box, set the scale of the Detail Data Frame to the scale you want. If you want different scales for different point features, you need to use a field containing these values and select Data Driven Scale on the Extent tab and choose this field. You cannot use a layer from another data frame, another map document, or a stand-alone layer file (.lyr) as an index layer. The index layer must be a feature layer. You cannot use raster-based layers as the index layer.
You should see a message box when creating Data Driven Pages and the index layer has more than 2,000 features. You can still create the pages, but be aware that performance may be adversely affected when dealing with such a large number of pages.
You may want to label adjacent grids on your layout. In a map book, this would be the same as labeling adjacent, or neighboring, pages. Using dynamic text, you can navigate through the pages of your map book and have the labels identifying neighboring pages update automatically. You can use the geoprocessing Calculate Adjacent Fields tool to create the data you can use to label adjacent pages.
Name Field
Each page in the map series needs a name, and the names are taken from this field. As Data Driven Pages iterates through the features in the index layer and each page is defined, the attribute value for the chosen name field is used as the page name.
The page name can be displayed on the Data Driven Pages toolbar. This can also drive a dynamic text element in the layout. You can add dynamic text for the page name using the Page Text menu item on the Data Driven Pages toolbar. Use the Page Name option. Or, you can apply the formatting tag <dyn type="page" property="page name"/> to an existing text element.
Select the Name Field from the list in the Name Field drop-down menu. The default is the first field using the string "name" in the field name. If there is no field using "name" in the field name, Data Driven Pages will then use the first available valid field. You do not have to use the default. You can choose to use a different field by selecting it from the drop-down menu.
This drop-down menu displays a list of applicable fields from the index layer. This list includes fields from a table joined to the index layer. These include short integer, long integer, and string.
To avoid confusion when working with Data Driven Pages, you should choose a Name field in which all values are unique. However, this is not required, and Data Driven Pages will accept null and duplicate values for Page names.
Sort Field
Pages in the map series need to be sorted. There needs to be a first page, a last page, and all the pages in between. The sort field provides the sorting logic and index for the pages. The first page of the series, or page 1, is determined based on the values of this field and whether the sort is in ascending order or not. The index always starts with 1 and ends with the number of pages created. This index changes when you change the sort field or refresh the pages after editing the sort field values.
Since sort order is required for Data Driven Pages to work, a default field is chosen each time a new index layer is selected. The default is the first field using the string "PageNumber" in the field name. In many cases, you may want to apply your own page number values. Often, these values also match the order in which you want to sort your pages. Again, these values may or may not match the page index number. If there is no field using "PageNumber" in the field name, Data Driven Pages will then use FID or ObjectID.
You do not have to use the default. You can choose to use a different field by selecting from the drop-down menu. The drop-down menu displays a list of applicable fields from the index layer. This list includes fields from a table joined to the index layer. These include short integer, long integer, float, double, date, and string.
The page index can be displayed on the Data Driven Pages toolbar. For example, you might see "14 of 20". This means you are looking at the 14th page of 20 pages. This can also drive a dynamic text element in the layout. You can add dynamic text for the page index using the Page Text drop-down menu on the Data Driven Pages toolbar. Use the Page with Count option. Or, you can apply the formatting tag Page <dyn typePage Text="page" property="page index"/> or <dyn type="page" property="page count"/> to an existing text element.
Page index is also reflected in the export dialog box. When you export Data Driven Pages using a page range, you are exporting pages based on their location in the index. The page index may or may not be the same number as the page number. The page index is internally generated, always begins with 1, and ends with the total number of pages. Page numbers can be alphanumeric, begin after 1, and end with a number greater than the total number of pages (this might be done to account for inserted pages in the final product).
Data Driven Pages will accept null and duplicate values in the Sort field, but you should try to avoid this whenever possible.
Optional Fields
The Data Driven Pages setup provides three optional fields that you can use to further customize your pages. These fields must be an attribute of the index layer or field from a table that is joined to the index layer. They are
- Rotation
- Spatial Reference
- Page Number
Rotation
There are some use cases where you want to apply a map rotation to specific pages or all pages in your map series. For example, a common type of map series or map book that requires map rotation is a strip map. A strip map often follows a linear feature. To make such a map series more readable, the map's page orientation is such that the linear feature draws from top to bottom and is centered on the page. This requires that the data frame be rotated. Though you can use any numerical index layer field to apply rotations to Data Driven Pages, you may want to consider using the Strip Map Index Features geoprocessing tool to create an appropriate index layer. This tool creates a new index layer that contains a field with appropriately calculated values for rotation based on your input.
Add this new layer to your map document and use it as the index layer for the Data Driven Pages. Select the appropriate field as the rotation field. As Data Driven Pages iterates through each page, an appropriate map rotation is applied to the Detail Data Frame based on the values of this field. If the value is null, Data Driven Pages uses a value of 0. Map rotation moves in a counterclockwise direction. If the value is negative, the rotation is clockwise.
If you do not want to apply different map rotations to your pages, or want to use only the rotation value specified on the General tab of the Data Frame Properties dialog box (for the main data frame), do not specify this field.
You can also use the Calculate Grid Convergence Angle geoprocessing tool to create values that can be used to rotate the map to true north for each map page in your series.
This drop-down menu displays a list of applicable fields from the index layer. This list includes fields from a table joined to the index layer. These include short integer, long integer, float, and double.
Spatial Reference
There may be cases where you want to use specific spatial references for specific pages in your map series. You have three different ways to apply spatial references in Data Driven Pages. One way is to use the entire spatial reference string. This way, you can customize spatial reference parameters as you see fit.
Here is an example of a spatial reference string for geographic coordinate system WGS 1984:
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.0174532925199433]]
A drawback to using the spatial reference string is that it can be very long and cumbersome. It is too large to store in a shapefile. Another way to apply spatial references is to point to a projection file on disk, if you have one. This can be a file local to your machine or a file on a network. You need to have the proper permission to these files.
Here is an example of the path to the WGS 1984 projection file:
C:\MyProjectionFiles\WGS 1984.prj.
The last way to apply spatial reference is to use factory codes. A factory code is an integer identifier that is unique by coordinate system. Custom coordinate systems have a factory code of 0. Factory codes can be stored as either short or long integers.
The factory code for geographic coordinate system WGS 1984 is 4326.
When you specify a Spatial Reference field, values from this field define the spatial reference of the main data frame for each page in the Data Driven Pages series. If the value in this field is null, incomplete, or otherwise unusable, Data Driven Pages ignore the field and apply the last spatial reference used to the current page.
There are two geoprocessing tools available from the Data Driven Pages toolset in the Cartography toolbox to help you populate a spatial reference field: Calculate Central Meridian and Parallels and Calculate UTM Zone.
If you do not want to apply different spatial references to your pages, or want to use only the spatial reference specified on the General tab of the Data Frame Properties dialog box (for the main data frame), do not specify this field.
This drop-down menu displays a list of applicable fields from the Index Layer. This list includes fields from a table joined to the Index Layer. These include short integer, long integer, and text.
If you select a field for Spatial Reference, create Data Driven Pages (by clicking OK) then decide you do not want to use the field to drive spatial references, you cannot simply choose none from the drop-down list to go back to a default spatial reference. There is no default spatial reference. Data Driven Pages always uses the last valid spatial reference if one is not supplied. You must manually change the spatial reference to get the data frame back to the one you want.
Page Number
Data Driven Pages also allows 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 are 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. You can add dynamic text for the page index using the Page Text drop-down list on the Data Driven Pages toolbar. Use the Page Number option. Or, you can apply the formatting tag Page <dyn type="page" property="page number"/> to an existing text element.
Page number may or may not be the same as page index. In many cases, you will want the first map in your map book to be on the page after page 1. You may also want gaps in the page numbering to allow for inserted pages.
For example, suppose you are designing a map book where there will be pages for 10 map features. You want the map book to include a title page, a table of contents, and an overview map, and you want tabular information to be inserted between each map page. You need to incorporate a number of files to get this final product. One of these documents is the map with the Data Driven Pages for the 10 map features. To account for the anticipated pages at the beginning of the map book and the inserted page between each map page, add a Page Number field to the index layer and populate the field as follows (the features have already been sorted accordingly).
Page number |
---|
Page 4 |
Page 6 |
Page 8 |
Page 10 |
Page 12 |
Page 14 |
Page 16 |
Page 18 |
Page 20 |
Page 22 |
You select this field from the page number drop-down list and create your data driven pages. Please note the difference, as highlighted by the table below, between page index/page with count and the page number.
Page index |
Page number |
Page with count |
---|---|---|
1 |
Page 4 |
1 of 10 |
2 |
Page 6 |
2 of 10 |
3 |
Page 8 |
3 of 10 |
4 |
Page 10 |
4 of 10 |
5 |
Page 12 |
5 of 10 |
6 |
Page 14 |
6 of 10 |
7 |
Page 16 |
7 of 10 |
8 |
Page 18 |
8 of 10 |
9 |
Page 20 |
9 of 10 |
10 |
Page 22 |
10 of 10 |
This is an optional field. The drop-down menu is filtered to display applicable field types. This list includes fields from a table joined to the index layer. These include short integer, long integer, double, and text.
Page numbers should be unique, though Data Driven Pages accepts null and duplicate values.
Starting page number
In some cases, you may want to start the map series pages at a page other than the first page. For example, you may want the first three pages in your map book to be for a title, a table of contents, and an overview map. The maps (the results of the Data Driven Pages PDF export) actually begin on page four. You enter 4 in the Starting Page Number text box on the Data Driven Pages Setup dialog box. If you have a dynamic text element for page numbers in your layout, you should see Page 4 displayed for the first map page. Remember, since this is the first map, the index number for this page is 1. If you wanted to export only this page, you would use 1 to identify the page in the Page Range text box even though the page number is 4.
Learn more about exporting Data Driven Pages
Here is a breakdown of page index, page number (dynamic text), and page number with count (dynamic text) for a map series of 10 maps and the starting page number set at 4.
Page index |
Page number |
Page with count |
---|---|---|
1 |
Page 4 |
1 of 10 |
2 |
Page 6 |
2 of 10 |
3 |
Page 8 |
3 of 10 |
4 |
Page 10 |
4 of 10 |
5 |
Page 12 |
5 of 10 |
6 |
Page 14 |
6 of 10 |
7 |
Page 16 |
7 of 10 |
8 |
Page 18 |
8 of 10 |
9 |
Page 20 |
9 of 10 |
10 |
Page 22 |
10 of 10 |
This option is only valid when page numbers are calculated internally. It is not valid when a page number field has been specified.
Optional settings (Map Extent)
The Extent tab allows you to define the margin between the edges of the data frame and the index feature for each page. There are three options: Best Fit, Center and maintain current scale, and Data Driven Scale.
Best Fit
The Best Fit option provides a margin, measured along the horizontal or the vertical axis, between the edge of the data frame and the closet point of the index feature. The location of this closest point determines whether the margin is measured along the horizontal or the vertical. Other points of measurement may be larger than the specified fit. This is especially true for index features that are geometrically asymmetric or irregular. This is expected.
A margin can be specified as a percentage, in map units, or in page units.
A percentage value of 100 percent places the closest point of the index feature adjacent to the edge of the data frame. Values greater than 100 percent result in a margin between the feature and the data frame edge. The size, or distance, between data frame edges is calculated as a percentage of the distance, in map units, of the axis containing the closest point. For example, the closest point is along the vertical axis. The longest vertical length of the feature is 150 km. A margin percentage value set at 110 percent results in a data frame of (150 km * 110%) = 165 km, with a margin of 7.5 km on either side. Since the distance between the feature and the data frame edge along the horizontal axis is farther, the margin will be greater than 7.5 km. Values less than 100 percent shrink the data frame to an extent that is within the extent of the index feature.
Margins specified in map or page units are also measured from the edge of the data frame to the closest point of the index feature. Unlike percentage, the size value is applied to each side of the horizontal axis or the vertical axis. For example, a margin is set at 50 km. The closest point of the index feature is along the vertical axis. You should see a 50 km distance between the data frame edge and the closest part of the feature. At the other end of the axis, and along the horizontal, you will see margins greater than 50 km. You will see similar results if you choose page units to measure the margin.
Center and maintain current scale
By choosing the Center and maintain current scale option, the detail data frame for each page in the Data Driven Pages series is centered on the center of the index feature and maintains a constant map scale. The map scale is set in the Scale text box on the Standard toolbar.
Data Driven Scale
By choosing the Data Driven Scale option, the map scale of the detail data frame for each page in the Data Driven Pages series is data driven. Use the drop-down list to select an appropriate field containing the data you want to use to determine scale. The drop-down list is filtered to display applicable field types. These include short integer, long integer, float, and double.
When you specify a Data Driven Scale field, values from this field define the map scale of the detail data frame for each page in the Data Driven Pages series. If a value is null, Data Driven Pages uses the scale value of the previous page. Any fixed scale or a fixed extent associated with the detail data frame is ignored when Data Driven Pages are enabled.
Data Driven Pages Defaults
- Data Frame—The active data frame is used as the default data frame.
- Index Layer—The topmost polygon layer of the active data frame is used as the default index layer.
- Name Field—The first index layer field using the string "name" in the field name is used as the default name field. If there is no field using "name" in the field name, Data Driven Pages then uses the first available valid field. Valid field types for the name field include text, short integer, and long integer.
- Sort Field—The first index layer field using the string "pagenumber" in the field name is used as the default sort field. If there is no field using "pagenumber" in the field name, Data Driven Pages then uses FID or ObjectId.
- Optional Fields—None.
- Map Extent—Best Fit option at 125%.
How to create Data Driven Pages
These steps assume that you already have an index layer with all the needed fields for customizing the pages. If you need to create an index layer or create data in the index layer for the customizations described above, you can use geoprocessing tools from the Data Driven Pages toolset.
First, you should add the Data Driven Pages toolbar. The toolbar gives you access to the Setup Data Driven Pages dialog box, which you use to create your pages. You can also use the toolbar to navigate and refresh the pages, along with adding dynamic text for the page name or the page number.
Learn more about using dynamic text with Data Driven Pages
Adding the Data Driven Pages toolbar
To add the Data Driven Pages toolbar click Customize > Toolbars > Data Driven Pages or click the Display Data Driven Pages toolbar button on the Layout toolbar.
Creating Data Driven Pages
- Click the Setup Data Driven Pages button on the Data Driven Pages toolbar.
- Click the Definition tab.
- Check the Enable Data Driven Pages check box.
- Check the default for Data Frame. If this is not the data frame you want as the main data frame for the Data Driven Pages, choose a different data frame from the drop-down menu.
- Check the default for Layer. If this is not the layer you want to use as the Index Layer, choose a different layer from the drop-down menu.
- Check the default for the Name Field. If this is not the field you want to use to name your page, then choose a different field from the drop-down menu.
- Check the default for the Sort Field. If this is not the field you want use to sort your pages, then from choose a different field from the drop-down menu.
- Select a field for Rotation if you want to apply a rotation to each page. Otherwise, you can leave the default value of none.
- Select a field for Spatial Reference if you want to apply a rotation to each page. Otherwise, you can leave the default value of none.
- Check the default for Page Number. If this is not the field you want to use to get the page number for each page, then choose a different field from the drop-down menu. Alternatively, choosing no field for page number will result with page numbers automatically generated from the Starting Page Number value.
- Click the Extent tab.
- Choose the extent option that you want to use.
- Click OK.
Adding Page Name as dynamic text
- Click the Layout View button to make sure ArcMap is in Layout view.Note:
Dynamic text only works in Layout view.
- Click the Page Text drop-down menu on the Data Driven Pages toolbar.
- Choose Page Name from the list.
- Select the newly added text element and move it to the location you want it on the page layout.
Adding Page Number as dynamic text
- Click the Layout View button to make sure ArcMap is in Layout view.Note:
Dynamic text only works in Layout view.
- Click the Page Text drop-down menu on the Data Driven Pages toolbar.
- Choose Page Number from the list.
- Select the newly added text element and move it to the location you want it on the page layout.
Adding a dynamic text element for Page Number with Count (total pages)
- Click the Layout View button to make sure ArcMap is in Layout view.Note:
Dynamic text only works in Layout view.
- Click the Page Text drop-down menu on the Data Driven Pages toolbar.
- Choose Page with Count from the list.
- Select the newly added text element and move it to the location you want it on the page layout.