This project automates the end-to-end export of a large municipal atlas in ArcGIS Pro using two Python scripts built with arcpy.
The core problem: when exporting a map series, streets outside the current grid page were still labeling — causing overcrowded labels and throwing off key numbering by including streets not actually visible on that page. Simply using a definition query wasn't an option because the streets needed to remain visible for geographic context; they just shouldn't label outside their page boundary.
Script 1 — Street Query Builder iterates every page in the map series, performs a spatial selection of streets whose centers fall within each grid polygon, builds chunked OID-based SQL IN clauses (capped at 900 to respect SDE limits), and exports a .txt and .exp query file per grid page.
Script 2 — Map Series Export uses those query files as label SQL queries — not definition queries — so streets display but only label within their own page. It also dynamically toggles between 16k and 32k annotation groups based on a size field in the index layer, resolves target pages by GRID_NO, and exports a named PNG per page with full logging.
Tools used: ArcGIS Pro, Python, arcpy, arcpy.da, SDE enterprise geodatabase





