QGIS Report – Text-Based Template Language/Engine for Generating a Report from a QGIS Project

print-composerqgis

I know of Print Composer, Print Layout, Atlas, etc. but I would prefer something quite different. I want to write a template in pure text, similar to using Latex for a report, using Markdown for Jekyll or Stackexchange, etc.

I see two major benefits:

  • Text based tools are much easier to automate
  • Text based formats are much better for revision control, eg Git

Furthermore I have not been quite satisfied with QGIS' Print Layout this far, though it certainly is getting better.

I am hoping for a tool that could read a template a bit like what I made up below, and produce an HTML page that can be published online as a static website but is also printer friendly.

{% include header.html %}
{% include toc.html %}
{% for street in $streets.items %}
    {% sectionbegin title=$street.name %}
    {% map 
        coverage=$street.geometry
        layers=[{name='OSM', opacity=50%}, {name='streets', style='printer_friendly_street_style'}]  
    %}
    {% sectionend % %}
{% endfor %}

Best Answer

I suggest you to give a try to QGIS report wizard plugin https://plugins.qgis.org/plugins/qgis_report_wizard/ that outputs text (html, xml, markdown and so on) or odt reports from gis data making use of jinja2 template engine https://jinja.palletsprojects.com/en/3.1.x/templates/

You can easily insert in your reports fields data or images from your project canvas or from print layouts. In the test folder under the plugin repository you can find many examples that you can edit and modify for your purpuse: https://github.com/enricofer/qgis_report_wizard

Related Question