Skip to content

Workshop Lizmap#

Pre-requirements#

This workshop is designed for Lizmap users, half day.

  • FTP Client (WinSCP for Windows, Filezilla for MacOS/Linux)
  • QGIS 3.16
  • Lizmap plugin on QGIS Desktop
  • QGIS project attached in the email
  • The QGIS project contains layers from the PostgreSQL database

Documentation#

First quick map#

  • Open the project
  • Set the extent on the map canvas
  • In the Project Properties :
    • Relations tab, add all relations automatically with Discover Relations
    • QGIS Server tab,
      • Service capabilities, set a title and an abstract
      • WMS capabilities, use the current canvas extent
      • WFS capabilities, publish all layers
  • Open the Lizmap plugin
  • Only one time, add a server with your instance home page URL
  • Close the Lizmap plugin (it's creating the Lizmap file when closing the window).
  • Transfert the project (.qgs et .cfg) in the folder qgis/topic_workshop

Bonus if you have a small PNG picture called name_of_project.qgs.png.

Quick overview of the Lizmap web interface#

  • The map
  • Lizmap folders
  • Administration panel

Legend#

  • Add some groups in the legend
    • Editing with persons and observations
    • Data with municipalities
    • hidden, with small h, with species and you can add OSM base layer (from the QGIS Browser, XYZ Tiles)
  • Rename layers with a more human-readable
    • Except for the OSM layer, in the group hidden, the name must be osm-mapnik

legend

Starting from now, often send the QGS file and the CFG file on the server to check the result between each bullet item.

  • Make a quick symbology on a point layer :
  • Make a quick symbology on the municipalities layer : (already done ;-)
    • Categorized on name ()
    • Tip, change the symbol to remove the fill
    • Remove the line Water
  • Go in the Lizmap plugin, Layers tab
  • Set a link on a layer:
    • media/metadata.pdf, a PDF link, stored in the folder media (you can see it in the FTP client) on observations
    • https://en.wikipedia.org/wiki/French_Polynesia on municipalities
  • In the Lizmap plugin, go in Baselayers and add the OpenStreetMap Mapnik background.

Attribute table#

  • From the plugin, enable the attribute table for the municipalities layer.

Let's add some popups#

  • In the Lizmap plugin, enable some popups on the layer municipalities with auto mode.
  • Add some aliases on fields to "clean" them from the layer propertiesAttributes Form ➡ a specific field ➡ Alias.
  • Let's switch to a popup with QGIS mode :

Tip : QGIS ➡ ViewShow Map Tips to display maptip straight in QGIS Desktop.

These QGIS popups are powerful with the use of QGIS expressions:

1
2
3
4
<ul>
<li>[% "name" %]</li>
<li>[% "population" %]</li>
</ul>

You can use expressions :

1
2
* to display with capital letters
* to display in red if the population is less than 20 000 inhabitants

Editing capabilities on a layer#

We want now to enable editing capabilities on a layer in the Lizmap interface, to let some users add some observations.

  • In QGIS, try to add a point and check how the default form is displayed on the layer observations. You need to toggle editing mode first with the yellow pen.
  • Improve the form in QGIS :
    • Layer Properties ➡ Attributes Form -> Drag&Drop layout form
    • Remove the field id
    • Make two groups : Required and Optional

Drag/drop form

  • Field configuration :
    • fk_id_person :
      • Alias Watcher
      • Relation reference with name
    • fk_id_specie :
      • Alias Species
      • Value relation layer species, key column id and value es_nom_commun
    • date :
      • Alias Date
      • Date/Time; by default
    • photo :
      • Alias Photo
      • Attachment
    • gender :
      • Alias Gender
      • Value map and add some values in the table Male, Female

Form values

  • As soon as you have your form ready in QGIS (more or less 🙂), add the layer in the editing panel in Lizmap

PDF Print#

Extent chosen by the user#

  • In the given QGIS project, there is already a layout Landscape A4.
  • Enable print in your Lizmap plugin, second tab.
  • Customize the title from Lizmap web interface

From a popup, extent defined by the feature#

  • Duplicate the layout and let's transform it to an atlas:
  • Enable atlas on municipalities
  • Change the title to display the name of the municipality
  • Enable the map to "follow" the current feature
  • Check in the result in Lizmap

Dataviz#

  • Add bar chart in the Lizmap plugin about population in municipalities
  • Layer : Municipalities
  • X Field : Name
  • No aggregation
  • Trace : population
  • On "persons" layer, add a pie chart about each "watcher"
    • Add a virtual field in "persons" called count :
1
2
3
4
5
relation_aggregate(
    relation:='observation_fk_id_person_fkey',
    aggregate:='count',
    expression:="id"
)
  • Add pie chart in the Lizmap plugin
  • Layer : Persons
  • X Field : Name
  • Aggregation sum
  • Trace : count

Last update: September 27, 2021