I'm trying to create a report style output from ArcMap or ArcGIS Pro. The first page would be a map of a state with all locations of restaurants that are in the state. Then there would be a second page that gets exported that is a list of all of the restaurants from the first page map, sourced from a field in the data table. Before I chew away at writing a python script, does anyone know if the second page is possible from ArcGIS or at least Python?
2 Answers 2
This should be possible. A simplified workflow would look like:
- Export your map to PDF
- Use arcpy.SearchCursor to grab the list of restaurants from your feature class
- Write that list to PDF using a recommendation from How to create PDF files in Python
- Append the second PDF to the first using one of the methods described in How to append PDF pages using PyPDF2
-
I'll try that. Is there a way to associate the records being written out with the symbology in the map? In other words, the symbology for fast food restaurants have a certain symbol next to it, and the steak houses have their own symbology from the map?Dave– Dave2018年11月06日 13:56:36 +00:00Commented Nov 6, 2018 at 13:56
-
Your SearchCursor will allow you to determine the restaurant type. Based on this info, you could use a corresponding graphic from your local filesystem. (I don't happen to know if you can pull the symbols out of the map document using arcpy.)Andy– Andy2018年11月06日 14:22:38 +00:00Commented Nov 6, 2018 at 14:22
I know that this can be done using ArcPy with either ArcGIS Pro or ArcMap, by using no Python libraries other than ArcPy, and that the code for doing it is non-trivial.
I designed an automated PDF map generating system in ArcMap for a state geological survey but by the time that was funded the implementation was done using ArcGIS Pro instead.
After the project was completed I developed an eLearning training course in ArcGIS Pro with ArcPy to teach the techniques involved. The key concept involved is that of table-like feature classes.
An example of the PDF output from the code taught in that course appears below.
As you can see, for any country the course code creates PDF map output where the number of report pages (in this case six, the first two shown) is determined by how many populated places are in that country.
The course is not free. It is called Challenging Times with Python and ArcPy for ArcGIS Pro and is published at Udemy.
Disclosure: I am the developer and presenter of the course recommended above.