lizmap / lizmap-roadnetwork-module
Jelix module for Lizmap, which adds the tools of the QGIS plugin road network in the map
Package info
github.com/3liz/lizmap-roadnetwork-module
Language:JavaScript
Type:jelix-module
pkg:composer/lizmap/lizmap-roadnetwork-module
Fund package maintenance!
Requires
- php: >=8.1
Requires (Dev)
- jelix/jelix: ^1.8
- phpstan/phpstan: ^2.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Module for Lizmap Web Client, which adds in the map the tools of the QGIS plugin road network, to work with linear references (road, marker, abscissa, offset and side) in the browser:
- a panel to get the references of a point of the map, or to zoom on the point of given references,
- the creation of the geometry of a feature from references, in the editing form,
- the split and the merge of the lines of the managed objects, from their popup.
The tools are described in the documentation of the plugin.
Compatibility: Lizmap Web Client 3.9 and 3.10.
Requirements
- A road graph created with the QGIS plugin road network, in a PostgreSQL database.
- A QGIS project published with Lizmap, with:
- the layer
road_graph.edges, - the layer
road_graph.roads, published in WFS, with the fieldsid,road_codeand a field to sort the roads, - the Lizmap actions of the plugin, in the file
<project>.qgs.action, for the edges layer:get_references_from_point,get_road_point_from_reference,get_road_substring_from_referencesandget_edge_start_or_end_tip_from_references. The actionssplit_line_by_pointandmerge_selected_linesare optional, for the line layers of the managed objects, - the functions
public.lizmap_get_data(json)andquery_to_geojson(text)in the database of the edges layer, used by these actions.
- the layer
The documentation of the plugin gives an example of the actions file and of the functions. If one of them is missing, the tools are not loaded, and the reason is written in the Lizmap admin log.
Installation
With Composer
Into lizmap/my-packages, create the file composer.json if it does not exist, by copying the file
composer.json.dist, and install the module with Composer:
cp -n lizmap/my-packages/composer.json.dist lizmap/my-packages/composer.json
composer require --working-dir=lizmap/my-packages "lizmap/lizmap-roadnetwork-module"
Without Composer
Download the archive of the module from the
releases, and copy its directory roadnetwork
into the directory lizmap/lizmap-modules/ of Lizmap Web Client.
Launch the installer
php lizmap/install/configurator.php roadnetwork php lizmap/install/installer.php ./lizmap/install/clean_vartmp.sh ./lizmap/install/set_rights.sh
The installer creates:
- the right Use the road network tools in the map (
roadnetwork.use), in the group of rights Road network, - the group of users Road network Lizmap (
roadnetwork_lizmap), with this right. The useradminis added to it.
In the Lizmap administration, add the users to this group, or give the right to other groups. The tools are only loaded for the users with this right.
Configuration
The module is configured with variables of the QGIS project (Project properties > Variables).
It is used only for the projects with the variable road_network_edges_layer_id.
The algorithm Configure the project for Lizmap of the QGIS plugin road network sets them
in the current project.
| Variable | Default value | Description |
|---|---|---|
road_network_edges_layer_id |
Required. QGIS ID of the edges layer, on which the Lizmap actions are run | |
road_network_roads_layer_name |
roads |
Name of the roads layer, published in WFS, used to fill the list of roads |
road_network_roads_order_field |
road_order |
Field of the roads layer used to sort the list of roads |
road_network_min_scale |
50000 |
Smallest scale denominator for the click and hover tools: at a smaller scale, the user must zoom in |
road_network_zoom_scale |
2500 |
Scale denominator used to zoom on the point found from the references: the closest scale of the map is used |
road_network_split_rights |
createFeature,modifyGeometry |
Editing rights needed on a line layer to display the split button in its popup |
road_network_merge_rights |
createFeature,modifyGeometry |
Editing rights needed on a line layer to display the merge button. Add deleteFeature to also require the right to delete features |
The editing rights are the capabilities of the layer in the Lizmap editing configuration, separated by commas:
createFeature, modifyAttribute, modifyGeometry and deleteFeature.
An invalid value is replaced by the default value, with a warning in the Lizmap admin log.
Editing form
The road chosen in the references form, above the Lizmap editing form, is copied in the field road_code
of the editing form, if any. It is saved only if this field is editable, or hidden with the widget
Hidden of QGIS: Lizmap does not save a read-only field, for example a field not editable in QGIS,
or a field missing in the drag and drop form. With the QGIS plugin road network 0.9.1 or later,
the database replaces the road code of a feature by the closest road when its geometry moves away from its road.
Translations
The texts of the tools are in the files roadnetwork/locales/<language>/dictionary.UTF-8.properties,
in English and French. They are displayed in the language of the user interface of Lizmap.
The keys action.* translate the titles of the Lizmap actions and the messages returned by the database,
from their English text: if this text is changed in the actions file or in the function lizmap_get_data,
it is displayed without translation.
The translations are done on Transifex,
in the project of the QGIS plugin road network (resources lizmap-module-dictionary and lizmap-module-default).
The English files are sent to Transifex by the CI, and the translations are downloaded before a release:
export TRANSIFEX_TOKEN=...
make transifex-pull
Development
Linters:
# Keys of the texts used by the script and the template, in all the languages make check-dictionary # JavaScript and CSS (Node.js) make eslint stylelint # PHP: PHP-CS-Fixer and PHPStan (Docker) make php-cs-fixer phpstan # All of them make lint
The tests run on a Docker stack with Lizmap Web Client, QGIS Server and the test data of the plugin: see tests/README.md.
License
Mozilla Public License 2.0, see LICENSE.