Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a map book with data driven pages that shows the fire boundaries, roads, etc for our fire rescue department. I want to automate the process of creating individual mini map books for each fire station that only include the pages within their boundary. I started off by creating a model that will iterate through the district boundary names and select all pages with those boundaries:

enter image description here

Now, I'd like to take the selected pages and export them to a pdf in individual folders. My goal is to have a folder for each district name and within the folder have individual pdfs of the pages that make up that district.

I'm assuming the best way to do this portion is with arcpy.mapping so I have exported the model above to a python script:

# Import arcpy module
import arcpy

# Load required toolboxes
arcpy.ImportToolbox("Model Functions")


# Local variables:
Fire_Boundaries = "Fire Boundaries_exportPDF"
Grid = "HydrantGrid_exportPDF"
Selected_District = "I_Fire Boundaries_exportPDF_NAME"

# Process: Iterate Feature Selection
arcpy.IterateFeatureSelection_mb(Fire_Boundaries, "NAME #", "false")

# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Grid, "INTERSECT", Selected_District, "", "NEW_SELECTION")

I'm not sure where to go from here with arcpy/python? Any help would be appreciated.

share|improve this question
1  
Also note that exporting models to Python isn't really a good practice as you'll just have to go back and fix things that don't export correctly (like your iterator) and it's just not as clean as if you write it well from scratch. –  blah238 Nov 13 '13 at 17:16
3  
A few resources that should get you going in the right direction are: "DataDrivenPages using arcpy.mapping" in the online help and an Esri blog article called "Combining Data Driven Pages with Python and arcpy.mapping". Also, take a look at the existing questions tagged with arcpy and data-driven-pages –  RyanDalton Nov 13 '13 at 17:25
    
@RyanDalton +1 for the ESRI blog link, I used that post as my starting point for doing DDP in Python and it really helped me with many scripts doing various things. –  Arabella Nov 14 '13 at 10:53
    
As mentioned by @blah238 exporting models as a starting point for a Python script ceased to be good practice when iterators were added to ModelBuilder. For example, you have Iterate Feature Slection, which is intended only for ModelBuilder in your Python script. To start on this I would use a cursor to go through an "index" feature class, set the extent to each feature, then export to one PDF per feature. From this basis you should be able to see where/how to embellish. –  PolyGeo Feb 24 at 22:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.