Locate by layer
The idea of this tool is to present to the Lizmap Web Client user a drop down list that gives the ability to zoom on one or more spatial objects of the layer.
Consider a spatial vector layer districts contained in the QGIS project. We choose to add these districts in the tool Locate by layer, to allow Lizmap Web Client users to quickly position on one of the districts.
Once this layer added in the tool Locate by layer, a drop down list of the districts appears on the Lizmap Web interface.
When the Web map user selects one name in this list, the map will automatically refocuses on the selected district and the district’s geometry is displayed (optional).
The layer must be published as WFS (see OGC Services Capabilities) and the primary key must be published as well in the Layer properties.
This tool is not designed for layers having a lot of features or a lot of complex geometries. The web browser will indeed have to download all features with vector geometries so it will make the loading the application slower. To reduce the loading time, you can reduce the decimals in the WFS settings for instance if your layer is in meters. For better performance if your layer is stored in PostGIS, use PostgreSQL search.
Configuring the tool
To add a layer to this tool:
Click the button.
choose the layer with the first dropdown from the list of the project vector layers
then the column that contains the label you want to display in the dropdown list
if you want to add pre-filter your data if a optional group by, use the Optional group by field.
if you want the geometry of the related objects is also displayed on the map when the user selects an item from the list, then check the option Display the geometry
If you set a value above 0, autocompletion will be used after this amount of characters while the user types. The classical combobox will be replaced by a editable text input.
If Lizmap must trigger the filter on the layer. Only the selected feature will be visible on the map.
To edit a layer in the table, select it and click the button or double click on the row.
To remove a layer from the table, select it and click the button.
To move a layer up or down, select it and click or buttons. The order will change in Lizmap too.
If we take the example of districts, it may be interesting to also provide to the user a sub-districts dropdown. We wish that when the user chooses a district, the dropdown of sub-districts is automatically filtered to display only the sub-districts of the chosen district.
For this, there are 2 methods:
you either have 2 separate vector layers: one for districts and for sub-districts. So you have to use a field join between the two layers to enable automatic filtering lists in Lizmap
either we have only 1 layer for sub-districts, and then you can specify with the plugin a group field. Two dropdowns will be created instead of one in the Web application.
Don’t forget to check if your configuration of QGIS server is the right one (in Lizmap : My account -> Lizmap configuration -> check if the qgis server version is the right one, if not, you can use the button ‘modify’ below). If the configuration is not right the location will be wrong!