6

I have a polygon layer which has lots of attributes, and I'd like to create a report template which summarises these attributes for individual polygons.

That is, the user will select a polygon from one layer, and see a formatted report showing the relevant attributes for that polygon. There are also features in multiple other featureclasses which are related via an ArcMap relationship, and which should also be summarised on the same report.

It's been a few years since I last used ArcMap's Report Wizard, and it doesn't seem that much has changed in the meanwhile. It still looks quite complicated and cumbersome to set up and format a report, so I'm looking for any alternatives which might exist.

Before I write something from scratch, can anyone recommend any other approaches or code samples which might help? Since the data is stored in a file geodatabase, with the relationships defined in ArcMap, I am assuming I'll need to use arcpy to obtain a reference to the data and traverse the relationships.

StackOverflow has a question on creating an HTML report using Python which will probably be my starting point, unless there's anything else out there.

2

My personal call would be to go with jinja2 as the SO question you linked to suggests. You could extend that if you prefer working with markdown with the jinja2 markdown extension which will hopefully mean you won't have to write as much into your template.

Otherwise if you'd rather an Excel report (which might not suit your use-case of interactivity exactly, but if you wanted to do a larger dump perhaps) you could take a look at openpyxl. It gives a lot of control over the final appearance as well, though again it can be quite fiddly.

4

If you are interested in PDF output via Python/ArcPy, then I have used the ReportLab open-source PDF Toolkit to do something similar.

Its syntax is non-trivial but I found that the results were worth the learning curve.

Some of my learnings resulted in StackOverflow Questions and Answers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.