“In this lesson we will dive deeper into creating customised reports with InaSAFE”
In this module, we will focus on developing a simple infographic-style report for an InaSAFE flood on population report. When designing your own report, a good starting point is to take one of the existing map reports generated by InaSAFE and extend it. This lesson requires that you use a lot of your own initiative and also explore the various expressions provided by InaSAFE. Take careful note of the help that is provided. We recommend that you build on the work from InaSAFE Customising map reports (part 1), though it is not required.
Goal: To develop your own infographic report as an additional page of the standard flood on population report
*The people affected expression is not included in the specification table below - you need to work that out for yourself. Once your infographic has been saved in the InaSAFE folder, generate a flood report (using the InaSAFE print dialog override template option) and save it as a PDF. We have included a sample PDF output in the resource zip file attached to this lesson, as well as our example template.
Once you have produced the infographic as shown below, add your own enhancements to the template by changing fonts, colours, adding new infographic elements and images.
Name | Expectation |
---|---|
Input layers |
tandale_floods, wards, worldpop_25 |
Analysis question |
In the event of Floods, how many People will be affected? Summarise the results by Wards. |
Print options (report development) |
Uncheck all InaSAFE reports, select the standard portrait and template map reports |
Print destination |
Open in composer |
Print composer number of pages |
3 |
Page 2 |
A Single HTML Element [% analysis_summary_report() %] |
Page 3 logo |
~/.qgis3/python/plugins/inasafe/safe/resources/img/logos/inasafe-logo.png |
Page 3 title |
[% @map_title %] - [% format_date( @start_datetime , 'dd MMMM yyyy')%] |
Page 3 displaced count |
[% inasafe_analysis_summary_field_value( 'displaced')%] |
Save template filename |
~/.qgis3/inasafe/flood-popiulation.qpt |
Print options (report preview) |
Uncheck all InaSAFE reports, select the override template |
Print destination (report preview) |
Open as PDF |
Certain of the expressions provided by InaSAFE are only available in certain contexts. Some only work with a multi-exposure analysis (which we cover in a separate lesson). Some are valid only when a specific type of hazard or exposure has been used.
Also, the expressions may be specific to a certain type of composer element. For example, HTML expressions are best used with the HTML composer element type, image elements with a composer image element and so on.
Some of the expressions provided by InaSAFE perform field lookups on the data layers produced by InaSAFE. In our exercise able we see an example of this: inasafe_analysis_summary_field_value( 'displaced'). In this example, if retrieves a field from the analysis summary table (which only ever has one row). The lookup will return the value of the specified field.
For the most part you should learn by experimentation and by looking at other templates. For really advanced usage, look at the InaSAFE real-time templates.
What is the maximum number of pages you can include in your report?:
In this expression what will be returned? [% inasafe_analysis_summary_field_value( 'displaced')%]:
Download the sample data for the lesson.