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.