Have you ever wanted to extend your map automation scripts to include layer masking and clipping without having to open the map document? With the recent release of Esri Production Mapping 10.2 you can do just that and much more! The ArcPyProduction site package in Production Mapping has been extended since its last release to include several functions to easily automate cartographic workflows using Python. For example, to manage grids and graticules layers, and quickly and easily update data frame properties such as clipping and layer masking. The Make Topographic Grid And Update Map Template Python script combines the capabilities of ArcPyProduction, ArcPy, and geoprocessing to demonstrate one such workflow.
The Make Topographic Grid And Update Map is a tool in a Python toolbox called Update Map Document Using ArcPyProduction. The script can be run on any map document with a selected extent to create grids and graticules layers for that extent and update data frame properties such as projection, scale, and size according to the grid created; clip it to other layers in the map; and finally enable layer masking in the map. This script determines the appropriate grid definition based on the location of the selected extent. If the extent overlaps multiple UTM zones, then it generates converging zone grids, which are also referred to as zipper grids. In all other cases, it generates a standard grid. The output is a modified map document that can then be used or combined with other workflows or models.
To test the tool, we used it to create a grids and graticules layer for an area over Virginia and clip the data frame to the extent, with masking of the ladder annotation enabled. It did the job perfectly!