Data driven pages

By Wes Jones, Esri Design Cartographer

DDP thumbnail

“Data Driven Pages” is the term used to describe some new functionality in ArcGIS 10 that allows you to create a multi-page map series from a single map document. Data Driven Pages are available at the ArcView license level.

How do Data Driven Pages work?

To use Data Driven Pages you first need to create or identify an index layer. This layer contains features that define the extent of the main data frame for each page in the series. Using this index layer, Data Driven Pages generates one page per index feature from a single layout. The index layer contains the “data” that “drives” the creation of the pages in the series – hence the name “Data Driven Pages”. The index layer can also be used to define a number of other things that can be added to the maps, including the page name, page number, map scale, rotation angle of the data frame, and coordinate system. The index layer is often a rectangular grid, but other variations include extents for linear areas in a strip map series, or irregular shaped polygons that identify the areas of interest to map (e.g., ecological study areas, counties, states etc…)

To work with Data Driven Pages, there is a special toolbar that can be enabled by clicking Customize on the top bar menu, then clicking Toolbars, and then clicking Data Driven Pages. The first button on this toolbar allows you to create and customize new Data Driven Pages.

DDP toolbar

Figure 1: Data Driven Pages Toolbar

In ArcToolbox, in the Cartography Tools Toolbox, there is also a Data Driven Pages toolset that contains special geoprocessing tools that work with Data Driven Pages. Geoprocessing functionality includes the ability to calculate coordinate system information, such as the central meridian and UTM zone, calculate the rotation angle for true north, and create and populate fields to label adjacent pages.

DDP toolset

Figure 2: Data Driven Pages Geoprocessing Toolset

For an overview of the new Data Driven Pages functionality, see the Data Driven Pages post on the ArcGIS Desktop Blog. For more complete information and step-by-step instructions, review the online help topics that relate to Data Driven Pages.

Do map elements update from one page to the next?

Yes, they do. Elements such as the map extent, map scale, north arrow, and bar scale update from one page to the next. In addition, Data Driven Pages allow you to use dynamic text. “Dynamic text” is a term that describes text on the page that changes dynamically from one page to another – this is another new capability introduced in ArcGIS 10.  Dynamic text elements include page name, number and count, as well as labels identifying neighboring pages. Dynamic text has tags to automatically identify document properties such as the pathname and the time the .mxd was saved. In fact, any attribute for features in the index layer can be used for dynamic text and updated automatically with Data Driven Pages. To insert dynamic text, from the top menu, click Insert, and then click Dynamic Text. You will see the many options you have available to you.

DDP dynamic text

Figure 3: Dynamic Text

How do I print and export Data Driven Pages?

ArcMap’s print and export functionality have been updated to support Data Driven Pages. When Data Driven Pages are enabled, you have the option to print or export the current page, all pages, or a specific range of pages. When exporting to PDF, all the pages can be exported into a single PDF document.

DDP export

Figure 4: Options for Exporting to PDF

Can I use python scripting with Data Driven Pages?

Yes, you can. In addition to all the out-of-the-box functionality available with Data Driven Pages, there is an arcpy.mapping site package that allows for additional geoprocessing and customization. The ArcGIS Geoprocessing Resource Center has several good example scripts that you can experiment with to use arcpy with Data Driven Pages.

Is there a template I can use to learn more?

Yes, there is. On the Map Templates page of the ArcGIS Resource Center there’s a template I created that uses Data Driven Pages to compile a Legislative District Atlas of Massachusetts. This is a good resource to use to learn some of the basic Data Driven Pages functionality.

DDP template

Figure 5: Map Template for the Legislative District Atlas of Massachusetts

What’s in the template that’s exciting?

I am glad you asked! One of my goals when I was creating the template was to showcase Data Driven Pages and to help you become more familiar with their use. A second goal was to showcase how Data Driven Pages can help you create great cartographic products. This template is worth exploring if you are involved in map series production and you want to learn about a new faster and easier way to make attractive map books with ArcGIS.

These are five interesting features in this template:

  1. This templates shows you how Data Driven Pages can be used to automatically update map elements, such as the bar scale, scale text and page number, and text, such as the title or page number, as the pages change.
  2. This template shows you how to label using a Page Definition Query so that only certain features appear on the appropriate Data Driven Page.
  3. This template shows you how to relate information in two different data frames (in this case, the keymap updates as the map extent for each Data Driven Page updates).
  4. This template shows you how to position a keymap (an inset map that shows an overview of the mapped location) in the optimal position on the layout depending on the extent of the data on each page.
  5. This template shows how an entire map book can be created and collated in ArcGIS.

Let’s look at each of these in a little more detail.

1: Automatic Updating of Map Elements and Dynamic Text: I added a page name, bar scale, and scale text to the map surrounds that update with each Data Driven Page. The page name (that indicates the district number) is an example of dynamic text. The bar scale is worth noting because it is a normal map element that now updates with each Data Driven Page. The scale text is interesting because it can be inserted as a map element or dynamic text and in either case will update with each Data Driven Page. In this template, I inserted it as dynamic text to showcase this new option.

2: Use of Page Definition Query: At the larger scales this template shows the road and street network. For the legislative district atlas, only the street names that bound the districts need be identified.

DDP labeling

Figure 6: Smart labeling with Page Definition Queries.

Using the new Page Definition Query functionality available with ArcGIS 10, this template shows how you can achieve smarter labeling. Similar to other definition queries, Page Definition Queries allow you to specify with a SQL query which features or labels of a layer are drawn, but the difference is that they dynamically update for each page. With this functionality it is possible to restrict labeling, in this case, to the district shown on each Data Driven Page.

DDP page definition query

Figure 7: Page Definition Query

3: Relating Information from Different Pages: The keymap also updates to highlight the same district as the main map; this link between the main map and the keymap was set up through a Page Definition Query that was mentioned above. This new functionality brings added intelligence to the map by providing connections among data frames.

DDP keymap PDQ

Figure 8: Keymap and Main Map in Sync

4: Determining the Optimal Keymap Position: The map template shows each legislative district for Massachusetts on a different page. I first designed the layout so that the keymap was placed in the top left corner of each page. Consequently, sometimes it overlapped the main map information. In order to maximize the space for the main map, an arcpy script was written to determine the extent of the mapped district and move the keymap to a corner where it did not cover any vital information. This customizable script is provided in the template.

DDP keymap

Figure 9: Optimal Keymap Locations

5: Creating and Collating a Map Book: This template shows a real world example of how to create a map book entirely in ArcMap. Every portion of this map book was made with ArcGIS. For example, I made the cover page for the map book in ArcMap using graphic as well as data elements, and arcpy was used to collate the book into a single PDF document. Again the template is located here: (http://resources.arcgis.com/gallery/file/map-templates/details?entryID=6D7B6DC7-1422-2418-8871-E75378E65C8C)

DDP atlas

Figure 10: Collating the Legislative District Atlas

Data Driven Pages are definitely worth exploring if you are involved with any map book or map series projects. Data Driven Pages gives you an easy-to-learn way to produce them automatically using the data in your database. The Legislative District Atlas map template is a great resource you can use to gain practical experience working with the Data Driven Pages. I hope you have as much fun with the map template and Data Driven Pages as I did!

This entry was posted in Mapping and tagged , , , , , . Bookmark the permalink.

Leave a Reply

20 Comments

  1. eulessdave says:

    Here’s instructions on how to make a street index to go with your new Data Driven Pages:

    1. (if necessary) Add a field to your street centerline file that will hold the concatenated values of prefix, street name, suffix, and suffix direction. Let’s call it FullName. Your streets will be shown in this order in your street index, so decide if you want to index by prefix or street name. You may want to show your streets, for example, as “W. Euless Blvd” which shows up under the W heading, or as Euless Blvd (W) which shows up under the E heading.
    2. Run the command Feature Vertices to Points on your street centerlines using the “ALL” option. The Input Features are your street centerlines, the Output Feature Class is your option (I’ll call mine Street_Endpoints). This will make points at all the vertices of each line segment with all the attribute data (and there’s LOTS of them). This gives you better odds of having each street be recognized in each grid.
    3. Perform a Spatial Join (using the command from the search window, NOT the one in the Join context menu). The target features are the Street_Endpoints, the Join Features are the grid you want to use (mine is called MapBookGrid). In the Field Map of Join Features area, leave only the FullName and grid name (or ID) fields (let’s call it GridName). Let’s call the output file Street_Endpoints_Grid
    4. Use the Dissolve tool on the Street_Endpoints_Grid file, and dissolve by both the FullName and grid_ID. Input features are Street_Endpoints_Grid, and I’ll call the output file Street_Endpoints_Grid_Dissolved. Check the boxes for FullName and GridName to create multipoint features.
    5. Export the table of Street_Endpoints_Grid_Dissolved to a comma delimited text file.
    6. Open the text file in Excel. You should have column A be FullName (lots of duplicates), and column B be the GridName. Remove anything else, if necessary, like the ObjectID.
    7. Type Alt-F11 to open the VB scripting window. From the main menu, select Insert > Module.
    8. Paste the following code into the window:
    ?
    Sub ConcatData()
    Dim X As Double
    Dim DataArray(5000, 2) As Variant
    Dim NbrFound As Double
    Dim Y As Double
    Dim Found As Integer
    Dim NewWks As Worksheet

    Cells(1, 1).Select
    Let X = ActiveCell.Row
    Do While True
    If Len(Cells(X, 1).Value) = Empty Then
    Exit Do
    End If
    If NbrFound = 0 Then
    NbrFound = 1
    DataArray(1, 1) = Cells(X, 1)
    DataArray(1, 2) = Cells(X, 2)
    Else
    For Y = 1 To NbrFound
    Found = 0
    If DataArray(Y, 1) = Cells(X, 1).Value Then
    DataArray(Y, 2) = DataArray(Y, 2) & “, ” & Cells(X, 2)
    Found = 1
    Exit For
    End If
    Next
    If Found = 0 Then
    NbrFound = NbrFound + 1
    DataArray(NbrFound, 1) = Cells(X, 1).Value
    DataArray(NbrFound, 2) = Cells(X, 2).Value
    End If
    End If
    X = X + 1
    Loop

    Set NewWks = Worksheets.Add
    NewWks.Name = “SummarizedData”
    Cells(1, 1).Value = “Street Name”
    Cells(1, 2).Value = “Map Page”
    X = 2
    For Y = 1 To NbrFound
    Cells(X, 1).Value = DataArray(Y, 1)
    Cells(X, 2).Value = DataArray(Y, 2)
    X = X + 1
    Next
    Beep
    MsgBox (“Street Index is done!”)
    End Sub
    ?
    9. Type Alt-F11 again to close the macros window.
    10. Type Alt-F8, then click Run. The data should be formatted into the street index that you need. Save the Excel spreadsheet into whatever format you may need to use in your map books.
    Note: The streets with only one GridName value will format column B as a number. Streets with multiple gridID’s will format column B as text. You can right-click on column B and select Format Cells, and select Text to get them all the same.

  2. hkelley2 says:

    I don’t have a “Page Definition…” button or “Search Order” button on the “Definition Query” tab on the “Layer Properties” window. I am running ArcGIS 10 SP1 with a SP 1 additional patch to fix “Load Objects”.

  3. wesjones says:

    The Page Definition button will not appear unless the Data Driven Pages are enabled, and if the Data Driven Pages are enabled it will not show up in the feature that is being used as the Index Layer.

    I am not sure what the “Search Order” button is referring to.

  4. ajh22 says:

    Hi there,

    Are you able to post the script for Optimising the location of the insert map please? As I am always attempting to do something similar?

    Cheers

    Andrew

  5. wesjones says:

    You can find a script for moving the inset map posted on the Geoprocessing Resource Center

    http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=FFBB051B-1422-2418-88A0-9DD853478BA3

    Thanks

  6. iegbulefu says:

    I need to create data driven pages that will match the section grid of my city, unfortunately this section grids are not equal, also the map i wish to replicate were produced based on the section grids.

    I have tried severally to create a map index that will match these section grids but it is not walking out as the grids i produced are polygons of equal sizes.

    My objective is to replicate in ArcGIS some old maps that were produced on Microstation and create a mapbook of the maps.

    Can I get some ideas on how to go about this matter

    thanks

  7. wesjones says:

    You should be able to use your section grid from your city as the index layer. Find the Data Driven Page tool bar and click the first button to access the setup. Then in the index layer section, select your section grid as the layer. This will use the section grid to drive the data driven pages.

  8. Jaker01 says:

    Hello,

    The codes are very helpful. I am just trying to figure out how to apply it to my maps.

    I set up the Data Driven Pages so they filter by District. Within each District, there are certain features that I want to show, such as roads. The problem is that my roads extend beyond the District. I want to use Python so I can show roads only in the District I am currently viewing.

    Eventually, I want to use the same type of script for other features such as Highway Shields.

    I have tried using page definitions, but they do not work.

    Thanks!

  9. wesjones says:

    You have two primary options if you want to show only the features within your current district. First, you can go to the data frame properties and clip to the current data driven page extent. This will show only features in the current district. Second, you can do a little geoprocessing and append disctrict information to the roads. Then you will be able to do a page definition query on the roads feature class to show only roads that match the current district.

  10. jbhikercat says:

    Hi Wes,

    Yesterday I found a python script to have two data frames on the same page tied to the data driven pages. For the life of me, I cannot find it again! Are you aware of this script or could you provide any clues on how to do it?

    Thanks,

    John

    • sediger says:

      You don’t need a script to do this. In your second (or third or forth…) frame, go to properties and set the extent of the frame to the frame that’s driving the pages. I believe that in the extent tab, you set the extent of the frame to “another frame” and then select the one that you are using as the Index frame. Sorry, I can’t check this at the moment; I mistakenly hit the print button on a 45 page map book (before saving my last changes) and it’s churning.

      I’m using 10.1, but I think that this works with 10.0 also.

      • Wes Jones says:

        Steve is correct, you don’t need to use a script to do this — set the extent of the frame to the frame that is driving the data driven pages.

        Thanks

        • orignalblend says:

          Good mornign Gents.

          I am having the same problem I can get the 2nd dataframe to move with the 1st (data driven page one) but I need it to rotate as well to the angle of the other frame. Will I need to write a script for this or is there another way (or does someone have one I can use)?

          Thanks.

          Richard

          • Wes Jones says:

            The second dataframe is supposed to move with the first dataframe, and we will address this in the next service pack. In the meantime, you could use something like this, in a script, to get the desired movement when you export:

            df2.rotation=dfindex.rotation
            arcpy.RefreshActiveView()

  11. keykeepr says:

    I’m getting used to data driven pages having used DS Map Books for many years. The one thing I can’t get it to do is when the individual page is rotated to say 270, the adjacent fields dynamic text does not rotate with it. Ex. if the dynamic label at the top of you page is tagged to be North, it stays North even though North is now on the right hand side of the page. I have not found anything in the forums addressing this. My index is for 507 fire districts that are drawn mostly on centerlines resulting in very irregular shapes. Very few of my indexes are square or rectangular.

    • Wes Jones says:

      This map package and python script should get you started Rotate Text

      Download the file and then follow the steps below:

      1)Create or select your index feature. Calculate your rotation field values if necessary.

      2)Run Calculate Adjacent Fields tool using your index feature and the field you wish to use to label neighboring features/pages

      3)Create your data driven pages using your index feature and rotation field.

      4)Insert dynamic text for adjacent pages using the Data Driven Page Attribute tag and the values you calculated in step 2, placing _N on the top of the page and _S on the bottom, etc, ignoring the rotation of the current page.

      5)Give each text element a name, the example uses Text_NW etc, so they can be easily found by the script. Save your mxd.

      6)Use the script (updated with your own values) to export your data driven pages. The script will loop through each page, find its rotation, and update each text element so its tag is correct for the current page’s rotation.

  12. mcmurrayjen says:

    Hi there – just getting to know data driven pages after many years of mapbook. I’m wondering if there’s a way to show an inset data frame only on the page it’s referring to? Otherwise I have to print all other pages, then move the data frame onto the main data frame to print the one(s) with an inset (larger scale/more detail, not a smaller scale key map). Nearly every multi-page map we print has at least one, if not multiple, insets. Am I out of luck on this one?

    Thanks

  13. wtwood says:

    I’m updating a parcel mapbook where the client now wants labels that show PLSS.
    Some parcels cross township and/or section lines and would need to show multible labels.
    I wanted to avoid creating a new feature class or adding a new field to our parcel data so any updates to the parcels would automatically update those labels.
    I wasn’t able to do a spatial join and even if I could it wouldn’t allow for the labeling of more than 1 PLSS attribute.