How to Automate Atlas Creation in ArcGIS Pro, using Python. This is not a question, but the result of long trial and error.
The old way of making an atlas for my organization was to use ArcMap/Desktop to create a new project for each page, and customize each one to a fare-the-well. It took ages and was stressful to the one handed the project (applause for Keith!).
Then ArcGIS Pro came along, but while we recognized that only a single project file was needed, the organization had come to expect that each location (read: "page") could ask for special cartographic edits, since each page needed to be made one-by-one due to the nature of our previously-published atlas' layout.
See, each page of our atlas has an 'information bar' running up one of its long edges: even pages have them on the left, odd pages have them on the right. Each page was arranged in alphabetic order of the Area's title, and one Area per page. If we added a new Area, or removed one, Every Page Thereafter needed its 'information bar' flipped to the other side. Add to that that the orientation of each page was either 'upward' or 'leftward,' depending on how best the cartographer could fit it to the page (scale could be anything), and the requirement for custom-built atlas pages becomes more logical, if not reasonable.
I was inspired by a presentation at OKSCAUG 2021 (Ranking Arterial Widening Projects using ArcPy Scripting, by Kevin Gustavson - City of Tulsa, Engineering Services, slides available here) to attempt our atlas production using ArcPy and Notebooks in ArcGIS Pro.
I eventually came up with a working ArcGIS Pro project file. I presented a less-involved version at OKSCAUG 2023 (Lost in the Dark: Prodding Your Way Through ArcPy in 'Pro with Notebooks), and I'd like to share all of it with anyone else interested in creating a similar project: Link to material used at OKSCAUG 2023.
I made a lot of mistakes, and found even more dead-ends. The ESRI Documentation that might've helped me in the endeavor was few to nonexistent, or unrecognizable as help, and the most important map I could find was an Object Model Diagram for the ArcPy Mapping Module.
The equations for updated/new page orientations just nudge the Areas into two possible arrangements: 'generally up' or 'generally left.' My pages are elongated rectangles bound along a longer edge, and the original page orientations could be 180° or worse; why display an Area that practically fit the page dimensions 1:1 with 'North is Down,' when I can recalculate it to 'North is Up?'
Note: When you ask Python to list the names of the Elements of a particular layout, they will always be in the same order shown by the Contents Window's list by drawing order order. You can call groups of elements by their group name, and I do so.
So, to everybody reading this, please use my project to support your own. I'm sure there are more efficient steps than what I took, but I couldn't find them. Hopefully this is helpful to someone. -DM
Solved! Go to Solution.