Select DDP features by location and export selected pages to PDF

Bonus post today – Python time! Often when I create data driven pages for different themes (Water Supply, Sanitation, Transport etc), I have to create several copies of my data driven pages index layer and edit it. This is because certain sections of the study area may not have any features for that particular theme. It’s not good enough to simply skip it, because the scale changes and there are other aesthetic factors to consider.

However, since most of these mapbooks are for asset management, how the map looks is not nearly as important as the data which can be seen, particularly the unique IDs of the features. This is why last night I came up with this script.

The DDP index layer is intersected with all the relevant feature layers, to ensure that only pages containing features for that service are selected for export. I also had the chance to use the exportToPDF function of the DataDrivenPages class. In Line 40, it allows for the export of the currently selected DDP pages.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s