Customised reports in InaSAFE

“InaSAFE report templates can be overridden. You can place a template in your user directory and it will be used in preference to the standard templates we ship with InaSAFE.”

For InaSAFE you can prepare QGIS composer templates to be used in reporting. To modify a template you need to copy it to your home directory in:
[HTML_REMOVED].qgis2\inasafe\<template name>
The following templates are customisable:
Note: In InaSAFE 4.2 we expect to change the standard template names – look out for the release changelog to see more information about this.
InaSAFE uses a ‘by convention’ based approach. Two conventions are supported:
Element ID's - InaSAFE looks for elements with specific id's on the composer page and replaces them with InaSAFE specific content.
Tokens within text elements - InaSAFE looks for text within a text item and tries to replace it. The text must be written in square brackets ‘[‘ and ‘]’.


You try:

Goal: Replacement tokens

More about

QGIS Variables (Settings -> Variables, Project properties -> Variables, etc.) Can also be used to manage certain elements in your template dynamically. For example if you set a heading background variable, you can use it on your template to determine the background colour, and then change it centrally for all reports.

Variable Name Description
inasafe_report_heading_background Background colour for the top heading
----------------------------------------------- -------------------------------------------------

Now you try

Create a custom template using some of the elements above. Make sure to give the template the correct name and to place it in the correct location. Now run an InaSAFE analysis and verify that your template is being used.

More about the composer templating

All of the standard features of QGIS composer definition can be used to. You should take advantage of this to create reports that address the specific needs of your organisation. These customisations support also advanced features like QGIS variables. We plan to support atlas in the near future.
We would really appreciate it if you could include the InaSAFE logo in your reports – it will help to support the work we are doing and to promote the project to a wider audience.

Check your knowledge:

  1. All functionality of QGIS can be used in report design:
    1. True
    2. False
  2. Mark all the correct statements:
    1. You cannot use custom reports for InaSAFE.
    2. To edit your template, look in the InaSAFE source code and modify it there.
    3. Never acknowledge InaSAFE in your report.

Further reading: