404
+ +Page not found
+ + +diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..44391f9a --- /dev/null +++ b/404.html @@ -0,0 +1,157 @@ + + +
+ + + + +Page not found
+ + +qwc-services
is a collection of loosely coupled micro-services for extending QWC2. The services communicate with each other via HTTP/Rest, and are mostly written in Python.
The easiest way to run qwc-services
is to use the readily available docker images, using the sample setup at qwc-docker.
To be able to run qwc-docker
, first install docker
and docker compose
:
Then, follow these steps:
+git clone https://github.com/qwc-services/qwc-docker.git
+cd qwc-docker
+cp docker-compose-example.yml docker-compose.yml
+cp api-gateway/nginx-example.conf api-gateway/nginx.conf
+
+python3 -c 'import secrets; print("JWT_SECRET_KEY=\"%s\"" % secrets.token_hex(48))' >.env
+
+Change the UID/GID which runs the QWC services to match the user/group which owns the shared volumes on the host by setting SERVICE_UID
and SERVICE_GID
in qwc-docker/docker-compose.yml
.
Set permissions for the shared solr data volume:
+sudo chown 8983:8983 volumes/solr/data
+
+docker-compose up
+
+The map viewer will run on http://localhost:8088/.
+The admin GUI will run on http://localhost:8088/qwc_admin (default admin credentials: username admin
, password admin
, requires password change on first login).
Next steps:
+ +If you don't need the advanced functionalities provided by qwc-services
or want to integrate QWC2 in another environment, you can run QWC2 as a standalone viewer.
To work with QWC2, you will need a minimal development environment consisting of git, node and yarn. You will also need a running QGIS Server instance which serves your projects.
+The fastest way to get started is by cloning the demo application:
+git clone --recursive https://github.com/qgis/qwc2-demo-app.git
+
+Next, install all required dependencies:
+cd qwc2-demo-app
+yarn install
+
+Then, start a local development application:
+yarn start
+
+The development application will run by default on http://localhost:8081.
+At this point, you can customize and configure the application according to your needs, as described in detail in the following chapters.
+The final step is to compile a deployable application bundle for production:
+yarn run prod
+
+You can then deploy the contents of the prod
folder to your web server.
Next steps:
+ + +qwc-docker
has a QWC configuration backend. That backend can be reached by default at http://localhost:8088/qwc_admin.
The configuration backend allows to assign users and groups to roles. The roles in their turn can receive permissions on resources. These configuration settings will be stored in the configuration database. Out of the box qwc-docker
comes with with a container qwc-postgis
that contains the configuration database.
Roles can be given permissions on resources. That means that if you want to give users or groups permissions on resources, then you have to first create a role, configure the permissions that the roles has on some resources, and then assign the role the users or groups.
+The following resource types are available:
+Map
: WMS corresponding to a QGIS ProjectLayer
: layer of a mapAttribute
: attribute of a map layerPrint template
: print composer template of a QGIS ProjectData
: Data layer for editingAttribute
: attribute of a data layerData (create)
: Data layer for creating featuresData (read)
: Data layer for reading featuresData (update)
: Data layer for updating featuresData (delete)
: Data layer for deleting featuresViewer
: custom map viewer configurationViewer task
: permittable viewer tasksFeatureInfo service
: Feature info serviceFeatureInfo layer
: Feature info layerThe resource name corresponds to the technical name of its resource (e.g. WMS layer name). Most notably, the name of a map
resource corresponds to the relative path to the project below qgs-resources
without .qgs
extension (so i.e. the resource name for qgs-resources/subfolder/project.qgs
will be subfolder/project
).
Note: If your QGIS project is configured to return the field aliases rather than the field names in GetFeatureInfo
, the resource name for layer attribute
resources corresponds to the alias of the field.
Available map
, layer
, attribute
and print_template
resources are determined from WMS GetProjectSettings
and the QGIS projects.
data
and their attribute
resources define a data layer for the Data service.
For more detailed CRUD permissions data_create
, data_read
, data_update
and data_delete
can be used instead of data
+(data
and write=False
is equivalent to data_read
; data
and write=True
is equivalent to all CRUD resources combined).
The viewer
resource defines a custom viewer configuration for the map viewer (see Custom viewer configurations).
The viewer_task
resource defines viewer functionalities (e.g. printing or raster export) that can be restricted or permitted.
+Their name
(e.g. RasterExport
) corresponds to the key
in menuItems
and toolbarItems
in the QWC2 config.json
. Restricted viewer task items are then removed from the menu and toolbar in the map viewer. Viewer tasks not explicitly added as resources are kept unchanged from the config.json
.
Note: The resource types, i.e. for custom QWC2 plugins, can be extended by inserting new types into the qwc_config.resource_types
table.
+These can be queried, e.g. in a custom service, by using PermissionClient::resource_permissions()
or
+PermissionClient::resource_restrictions()
from QWC Services Core.
Permissions are based on roles. Roles can be assigned to groups or users, and users can be members of groups. +A special role is "public". The "public" role applies always, no matter whether a user is signed in or is not signed in.
+Roles can be assigned permission for resources.
+The write
flag is only used for data
resources and determines whether a data layer is read-only.
Based on the user's identity (user name and/or group name), all corresponding roles and their permissions and restrictions are collected. +The service configurations are then modified according to these permissions and restrictions.
+By using the permissions_default_allow
configuration setting in tenantConfig.json
, some resources can be set to be permitted or restricted by default if no permissions are set (default: false
). Among affected resources are Map
, Layer
, Print template
, Viewer task
, FeatureInfo service
, FeatureInfo layer
. E.g.:
permissions_default_allow=true
: all maps and layers are permitted by defaultpermissions_default_allow=false
: maps and layers are only available if their resources and permissions are explicitly configuredThe display behaviour of restricted themes can be configured in the mapViewer
service configuration in tenantConfig.json
as follows:
{
+ "name": "mapViewer",
+ "config": {
+ "show_restricted_themes": false,
+ "show_restricted_themes_whitelist": [],
+ "redirect_restricted_themes_to_auth": false,
+ "internal_permalink_service_url": "http://qwc-permalink-service:9090"
+ }
+}
+
+show_restricted_themes
: Whether to show placeholder items for restricted themes. Default: false
.show_restricted_themes_whitelist
: Whitelist of restricted theme names to display as placeholders. If empty, all restricted themes are shown. Only used if show_restricted_themes
enabled. Default: []
.redirect_restricted_themes_to_auth
: Whether to redirect to login on auth service if requesting a restricted theme in URL params, if not currently signed in. Default: false
.internal_permalink_service_url
: Internal permalink service URL for getting the theme from a resolved permalink for redirecting to login (default: http://qwc-permalink-service:9090
). This is used only if redirect_restricted_themes_to_auth
is enabled and permalink_service_url
is set.The QWC Config Generator generates a JSON file for all permissions from the QWC ConfigDB. See READMEs of QWC services for service specific contents in permissions.json
.
Using the optional Registration GUI allows users to request membership or unsubscribe from registrable groups. These requests can then be accepted or rejected in the Admin GUI.
+Workflow:
+The architecture of qwc-services
is as follows:
qwc-docker
ships a pre-configured the qwc-services
ecosystem as an easy to use application.
Following is an overview of existing qwc-services
:
Applications:
+REST services:
+Configuration database:
+ +Configuration generator:
+ +qwc-docker
layoutThe layout of the qwc-docker
tree is as follows:
Path | +Description | +
---|---|
├─ api-gateway/nginx.conf |
+API gateway configuration. | +
├─ volumes/ |
+Contains folders which are mounted into the various containers. | +
│ ├─ attachments |
+Storage of files uploaded through the QWC2 editing functionality. | +
│ ├─ config/<tenant>/ |
+Service configuration files, generated by qwc-config-generator . |
+
│ ├─ config-in/<tenant>/ |
+Input configuration files, processed by the qwc-config-generator . |
+
│ │ ├─ config.json |
+Master configuration for the QWC2 viewer. | +
│ │ ├─ index.html |
+Viewer entry point. | +
│ │ ├─ themesConfig.json |
+Themes configuration. | +
│ │ └─ tenantConfig.json |
+Master configuration file for qwc services. | +
│ ├─ db/ |
+Storage of configuration database (see qwc-config-db ). |
+
│ ├─ info-templates/ |
+Custom feature-info templates (see qwc-feature-info-service ). |
+
│ ├─ jasper-reports/ |
+Jasper reports (see qwc-document-service ). |
+
│ ├─ legends/ |
+Custom legend images (see qwc-legend-service ). |
+
│ ├─ qgs-resources/ |
+QGIS projects and data referenced by the projects. | +
│ ├─ qwc2/ |
+QWC2 Viewer. | +
│ └─ solr/ |
+Fulltext search index. | +
├─ docker-compose.yml |
+Container configuration file. | +
├─ pg_service.conf |
+Database service definitions. | +
└─ pg_service-write.conf |
+Database service definitions for write connections. | +
The master configuration file for the QWC services is located at qwc-docker/volumes/config-in/<tenant>/tenantConfig.json
, where <tenant>
is the tenant name, default
by default. See Multi Tenancy for more details on tenants.
The file is structured as follows:
+{
+ "$schema": "https://github.com/qwc-services/qwc-config-generator/raw/master/schemas/qwc-config-generator.json",
+ "service": "config-generator",
+ "config": {
+ <ConfigGenerator config>
+ },
+ "themesConfig": "./themesConfig.json",
+ "services": [
+ {
+ "name": "<service name",
+ <Service config>
+ },
+ ...
+ ]
+}
+
+Refer to the qwc-config-generator
schema for the available ConfigGenerator config
settings.
themesConfig
is a relative path to the theme configuration file as documented in Theme configuration.
Theservices
block contains the configuration for the individual QWC services, as documented in the reference.
Note: All config settings can also be set as environment variables in capitalized form in docker-compose.yml
.
Note: Some variables must be set as environment variables in docker-compose.yml
:
ENV | +Default value | +Description | +
---|---|---|
INPUT_CONFIG_PATH |
+config-in |
+Base path for service configuration files | +
OUTPUT_CONFIG_PATH |
+/tmp |
+Base path for service configuration files | +
JWT_SECRET_KEY |
+******** |
+secret key for JWT token | +
TENANT_URL_RE |
+None | +Regex for tenant extraction from base URL. Example: ^https?://.+?/(.+?)/ | +
TENANT_HEADER |
+None | +Tenant Header name. Example: Tenant | +
qwc-services/docker-compose.yml
, setting the service mountpoint:SERVICE_MOUNTPOINT=/<mountpoint>
+
+Example:
+ qwc-print-service:
+ image: sourcepole/qwc-print-service:vYYYY.MM.DD
+ environment:
+ <<: *qwc-service-variables
+ SERVICE_MOUNTPOINT: '/api/v1/print'
+ volumes:
+ - ./volumes/config:/srv/qwc_service/config:ro
+ ports:
+ - "127.0.0.1:5020:9090"
+
+api-gateway/nginx.conf
, example: location /api/v1/print {
+ proxy_pass http://qwc-print-service:9090;
+ }
+
+mapViewer
config block of volumes/config-in/default/tenantConfig.json
, i.e. {
+ "name": "mapViewer",
+ "generator_config": {
+ # ...
+ },
+ "config": {
+ "print_service_url": "/api/v1/print/",
+ # ...
+ }
+ }
+
+services
in volumes/config-in/default/tenantConfig.json
, according to the service config schema, i.e. {
+ "name": "print",
+ "config": {
+ "ogc_service_url": "http://qwc-ogc-service:9090/",
+ "qgis_server_version": "3.16"
+ }
+ }
+
+The Configuration database (ConfigDB) contains the database schema qwc_config
for configurations and permissions of QWC services.
This database uses the PostgreSQL connection service qwc_configdb
by default, which can be setup for the corresponding database in the PostgreSQL connection service file qwc-docker/pg_service.conf
.
To use an external configuration database, either change the connection definition for qwc_configdb
in qwc-docker/pg_service.conf
or change the config_db_url
in qwc-docker/volumes/config-in/<tenant>/tenantConfig.json
.
An existing ConfigDB can be updated to the latest schema by running the database migrations from the qwc-config-db
directory:
git clone https://github.com/qwc-services/qwc-config-db.git
+cd qwc-config-db/
+# Install alembic, either globally or activate python virtualenv and run `pip install -r requirements.txt`)
+alembic upgrade head
+
+Note: The qwc_configdb
service definition must exist in the host, for instance:
cat $HOME/.pg_service.conf
+[qwc_configdb]
+host=localhost
+port=5439
+dbname=qwc_demo
+user=qwc_admin
+password=qwc_admin
+sslmode=disable
+
+When using qwc-docker
, updating the services is a simple as updating the image tags in qwc-docker/docker-compose.yml
.
Two versioning schemes are available:
+vYYYY-MM-DD
: These refer to the latest available version of the respective images (i.e. v2023.05.12
).vYYYY.X-lts
: These refer to the long term support version of the respective images (i.e. v2023.1-lts
).You can always check the available tags on dockerhub, for example at https://hub.docker.com/r/sourcepole/qwc-config-generator.
+The qwc-docker
Upgrade Notes documents major changes, and in particular all incompatible changes between releases which require changes to the application specific code and/or configuration.
A theme corresponds to a QGIS project, published as WMS and served by QGIS Server.
+The basic steps for configuring a theme are:
+The first step is to prepare a QGIS project for publishing. Besides the common tasks of adding and styling layers, the following table gives an overview of settings which influence how the theme is displayed in QWC2:
+What | +Where | +Description | +
---|---|---|
Service Metadata | +Project Properties → QGIS Server → Service capabilities | +Shown in the theme info dialog, invokable from the Layer Tree panel titlebar. | +
Title, keywords | +Project Properties → QGIS Server → Service capabilities | +Theme title, displayed in the Theme Switcher, and keywords, useful for filtering. | +
Map extent | +Project Properties → QGIS Server → WMS → Advertised extent | +The extent used as initial map extent when loading the theme, unless overridden in themesConfig.json . |
+
Queryable layers | +Project Properties → Data sources | +Mark layers as identifyable by the client. | +
FeatureInfo geometry | +Project Properties → QGIS Server → WMS Capabilities → Add geometry to feature response | +Return feature geometries with the GetFeatureInfo request. Allows the client to highlight the selected features. | +
Layer Display Field | +Vector Layer Properties → Display | +The field used in the identify results. | +
Layer Map Tip | +Vector Layer Properties → Display | +The contents of the Map Tip shown when hovering over layers in the client, if displaying Map Tips is enabled in the Layer Tree. | +
Layer Metadata | +Layer Properties → QGIS Server | +Shown in the client Layer Info dialog, invokable from the Layer Tree. | +
Scale range | +Layer Properties → Rendering → Scale dependent visibility | +The scale range within which a layer is visible, useful to improve rendering performance. | +
Initial visibility | +Layers Panel | +Initial visibility of layers and groups. | +
Rendering order | +Layer Order Panel or Layers Panel | +Rendering order of the layers. If layer re-ordering is enabled in config.json , the order from the Layer Order Panel is ignored. |
+
Print layouts | +Layout manager | +The print layouts offered in the Print plugin. | +
Print layout labels | +Layout manager | +Print layout labels with an ID will be exposed in the Print plugin. Note: a label ID starting with __ will not be exposed. |
+
Attribute form | +Vector Layer Properties → Attributes Form | +The configured attribute form will be displayed when editing in QWC2. | +
External layers | +Layer Properties → QGIS Server → Data URL | +Mark the layer as an external layer to avoid cascaded requests. See Configuring external layers. | +
Then, store the project in the publishing directory of your QGIS Server instance. When using qwc-docker
, store the project as *.qgs
below qwc-docker/volumes/qgs-resources
.
Alternatively, when using qwc-docker
, you can also store the project in a database in QGIS using Project → Save To → PostgreSQL (see Storing projects in database).
A common issue is that the project will reference datasources in locations which cannot be resolved when QGIS Server reads the project, in particular when running QGIS Server inside a docker container. To avoid such issues:
+*.qgs
project file. Remember to copy all resources along with the *.qgs
project file to the server.pg_service.conf
on your host system as well as in the qwc_docker/pg_service.conf
and qwc_docker/pg_service-write.conf
which are mounted inside the docker containers. For instance, to use default qwc-docker
database, use the qwc_geodb
service and add the service definition to your host pg_service.conf
as follows:[qwc_geodb]
+host=localhost
+port=5439
+dbname=qwc_demo
+user=qwc_service
+password=qwc_service
+sslmode=disable
+
+themesConfig.json
The next step is to configure the theme for QWC2. There are two approaches:
+qwc-docker
): Just copy the project file to the designated location and the qwc-config-generator
will automatically generate a theme configuration using default parameters.When using qwc-docker
, save your QGIS projects below qwc-docker/volumes/qgs-resources/scan
. Adjust the default settings (defaultMapCrs
, defaultBackgroundLayers
, etc.) as desired in qwc-docker/volumes/config-in/<tentant>/themesConfig.json
. Then generate the theme configuration.
You can configure an automatically configured theme as default theme by setting defaultTheme
in themesConfig.json
to the path to the QGIS project file below qwc-docker/volumes/qgs-resources
, without the .qgs
extension. For example to set qwc-docker/volumes/qgs-resources/scan/project.qgs
as default theme, you'd write
...
+"defaultTheme": "scan/project"
+...
+
+To use a custom thumbnail for an automatically configured theme, place a an image called <project_basename>.png
in qwc-docker/volumes/qwc2/assets/img/mapthumbs
. For example. if the project is called project_name.qgs
, the name thumbnail image would be named project_name.png
.
Note: The auto-scan directory can be is controlled by qgis_projects_scan_base_dir
in qwc-docker/volumes/config-in/<tentant>/themesConfig.json
.
The theme configuration file is located as follows:
+qwc2-app/themesConfig.json
qwc-docker
: qwc-docker/volumes/config-in/<tentant>/themesConfig.json
Note: when using qwc-docker
, the themes configuration may also be embedded as themesConfig
directly in qwc-docker/volumes/config-in/<tentant>/tenantConfig.json
.
The themesConfig.json
file contains a list of themes, optionally organized in groups, as well as a list of background layers:
{
+ "themes": {
+ "items": [
+ { <ThemeDefinition> },
+ ...
+ ], "groups": [
+ {
+ "title": <Group title>,
+ "items": [{ <ThemeDefinition> }, ...],
+ "groups": [ { <Group> }, ...]
+ },
+ ...
+ ],
+ "externalLayers": [
+ { <ExternalLayerDefinition> },
+ ...
+ ],
+ "themeInfoLinks": [
+ { <ThemeInfoLinkDefinition> },
+ ...
+ ],
+ "backgroundLayers": [
+ { <BackgroundLayerDefinition> },
+ ...
+ ],
+ },
+ "defaultMapCrs": "<Default map crs, defaults to EPSG:3857>",
+ "defaultBackgroundLayers": "<Default background layers, see theme definition below>",
+ "defaultWMSVersion": "<Default WMS version, i.e. 1.3.0>",
+ "defaultScales": [<Scale denominators, see theme definition below>],
+ "defaultPrintScales" [<Scale denominators, see theme definition below>],
+ "defaultPrintResolutions": [<DPIs, see theme definition below>],
+ "defaultSearchProviders": [<Search providers, see theme definition below>],
+ "defaultPrintGrid": [<Print grid, see theme definition below>],
+ "defaultTheme": "<Default theme id>"
+}
+
+Refer to the sample themesConfig.json
for a complete example.
The format of the theme definitions is as follows:
+ +Entry | +Description | +
---|---|
"id": "<id>", |
+Theme identificator. Autogenerated if not specified. | +
"url": "<WMS URL>", |
+The address of desired WMS served by QGIS Server. | +
"mapCrs: "<EPSG code>", |
+Optional, map projection, defaults to defaultMapCrs . |
+
"title": "<Custom title>", |
+Optional, override WMS title. | +
"description": "<Description>", |
+Optional, an additional description to show below the theme title. | +
"thumbnail": "<Filename>", |
+Optional, image file in assets/img/mapthumbs (see Viewer assets). If omitted, autogenerated via WMS GetMap. |
+
"attribution": "<Attribution>", |
+Optional, attribution which will be shown in the bottom right corner of the map. | +
"attributionUrl": "<URL>", |
+Optional, link associated to the attribution | +
"scales": [<Scale denominators>], |
+List of denominators of allowed map scales. If omitted, defaults to defaultScales . |
+
"printScales": [<Scale denominators>], |
+List of denominators of allowed print scales. If omitted, defaults to defaultPrintScales . |
+
"printResolutions": [<DPIs>], |
+List of available print resolutions. If omitted, defaults to defaultPrintResolutions . |
+
"printGrid": [ |
+List of grid scale-dependent grid intervals to use when printing. If omitted, defaults to defaultPrintGrid . |
+
{"s": <Scale1>, "x": <Width1>, "y": <Height1>}, |
+Keep this list sorted in descending order by scale denominator. | +
{"s": <Scale2>, "x": <Width2>, "y": <Height2>} |
+In this example, {x: <Width2>, y: <Height2>} will be used for <Scale1> > Scale >= <Scale2> . |
+
], |
++ |
"printLabelForSearchResult": "<ID>", |
+Optional, an ID of a print layout label to which the current search result text (if any) will be written to when printing. | +
"printLabelForAttribution": "<ID>", |
+Optional, an ID of a print layout label to which the current attribution text (if any) will be written to when printing. | +
"printLabelConfig": { |
+Optional, configuration of the text input fields for print layout labels. | +
"<LabelId>": {"rows": <n>, "maxLength": <n>}, |
+Height of the input field in rows and maximum number of allowed characters. | +
}, |
++ |
"extent": [<xmin>, <ymin>, <xmax>, <ymax>], |
+Optional, override theme extent. In mapCrs . |
+
"tiled": <boolean>, |
+Optional, use tiled WMS, defaults to false . |
+
"format": "<mimetype>", |
+Optional, the format to use for WMS GetMap. Defaults to image/png . |
+
"externalLayers": [{ |
+Optional, external layers to use as replacements for internal layers, see below. | +
"name": "<external_layer_name>", |
+Name of the external layer, matching a ExternalLayerDefinition , see below. |
+
"internalLayer": "<QGis_layer_name>" |
+Name of an internal layer, as contained in the QGIS project, to replace with the external layer. | +
}], |
++ |
"themeInfoLinks": { |
+Optional, custom links to additional resources, shown as a menu in the theme selector in the theme switcher.\ | +
"title": "<Menu title>", |
+An arbitrary string shown as title of the menu. | +
"titleMsgId": "<Menu title msgID>", |
+Alternative to title , a message ID, translated through the translation files. |
+
"entries": [<link_name>, ...] |
+List of theme info link names, see below. | +
}, |
++ |
"backgroundLayers": [{, |
+Optional, list of available background layers, defaults to defaultBackgroundLayers . |
+
"name": "<Background layer name>", |
+Name of matching BackgroundLayerDefinition , see below. |
+
"printLayer": "<QGIS layer name>"\|[<list>], |
+Optional, name of layer to use as matching background layer when printing. Alternatively, a list [{"maxScale": <scale>, "name": "<QGis layer name>"}, ..., {"maxScale": null, "name": "<QGis layer name>"}] can be provided, ordered in ascending order by maxScale . The last entry should have maxScale null , as the layer used for all remaining scales. If omitted, no background is printed, unless layer is of type wms and printExternalLayers is true in the Print plugin configuration. |
+
"visibility": <boolean> , |
+Optional, initial visibility of the layer when theme is loaded. | +
"overview": <boolean> , |
+Optional, set the layer as the overview map layer (i.e. this layer will be displayed in the overview map regardless of the background layer visible in the main map). | +
}], |
++ |
"searchProviders": ["<Provider>"], |
+Optional, list of search providers, see Search providers. Defaults to defaultSearchProviders . |
+
"minSearchScaleDenom": <number>, |
+Optional, minimum scale to enforce when zooming to search results. Takes precedence over value in config.json . |
+
"featureReport": { |
+Optional, available feature report templates. | +
"<LayerId>": "<TemplateID>" |
+WMS sublayer ID and associated template ID to pass to the featureReportService . |
+
}, |
++ |
"additionalMouseCrs": ["<EPSG code>"], |
+Optional, list of additional projections for displaying the mouse position. WGS84 and mapCrs are available by default. Additional projections definitions must be added to config.json . |
+
"watermark": { |
+Optional, configuration of watermark to add to raster export images. | +
"text": "<text>", |
+Arbitrary text. | +
"texpadding": <number>, |
+Optional, padding between text and frame, in points. | +
"fontsize": <number>, |
+Optional, font size. | +
"fontfamily": "<Font family>", |
+Optional, font family. | +
"fontcolor": "#RRGGBB", |
+Optional, font color. | +
"backgroundcolor": "#RRGGBB", |
+Optional, frame background color. | +
"framecolor": "#RRGGBB", |
+Optional, frame color. | +
"framewidth": <number>, |
+Optional, frame width. | +
}, |
++ |
"collapseLayerGroupsBelowLevel": <level>, |
+Optional, layer tree level below which to initially collapse groups. By default the tree is completely expanded. | +
"skipEmptyFeatureAttributes": <boolean>, |
+Optional, whether to skip empty attributes in the identify results. Default is false . |
+
"mapTips": <boolean>\|null, |
+Optional, per-theme setting whether map-tips are unavailable (null ), disabled by default (false ) or enabled by default (true ). |
+
"extraLegendParameters": "<&KEY=VALUE>", |
+Optional, additional query parameters to append to GetLegendGraphic request. | +
"extraDxfParameters": "<&KEY=VALUE>", |
+Optional, additional query parameters to append to DXF export request. | +
"extraPrintParameters": "<&KEY=VALUE>", |
+Optional, additional query parameters to append to GetPrint request (requires QGIS Server >= 3.32.0). | +
"printLabelBlacklist": ["<LabelId>", ...] |
+Optional, list of composer label ids to not expose in the print dialog. | +
"editConfig": "<editConfig.json>" |
+Optional, object or path to a filename containing the editing configuration for the theme, see Editing. | +
"snapping": {...}, |
+Optional, snapping configuration, see Snapping. | +
"config": { |
+Optional, per-theme configuration entries which override the global entries in config.json , see Viewer Configuration. |
+
"allowRemovingThemeLayers": <boolean> |
+See config.json for which settings can be specified here. |
+
... |
++ |
} |
++ |
"wmsBasicAuth": "{ |
+Optional, allows to authenticate to QGIS Server during themes.json generation. NOTE: these credentials will solely be used by yarn run themesConfig and won't be stored in themes.json . |
+
"username": <username> |
+Optional: http basic authentication username. | +
"password": <password> |
+Optional: http basic authentication password. | +
}, |
++ |
A bare minimum theme entry might look as follows:
+{
+ "id": "theme_id",
+ "title": "My theme",
+ "url": "/ows/my_theme",
+ "mapCrs": "EPSG:3857",
+ "backgroundLayers": [{"name": "background_layer_name"}],
+ "searchProviders" ["coordinates"]
+}
+
+Note:
+id
can be freely defined and will appear in the viewer URL as the t
query parameter.qwc-docker
, the url
can be specified as /ows/<relative_path_to_qgs>
where relative_path_to_qgs
is the path to the QGIS project file below qwc-docker/volumes/qgs-resources
, without the .qgs
extension. In the above sample, the project file would be located at qwc-docker/volumes/qgs-resources/my_theme.qgs
.External layers can be used to selectively replace layers in a QGIS project with a layer from an external source, for instance in the case of a WMS layer embedded in a QGIS project, to avoid cascading WMS requests. They are handled transparently by QWC2 (they are positioned in the layer tree identically to the internal layer they replace), but the GetMap
and GetFeatureInfo
requests are sent directly to the specified WMS Service.
Configuring external layers via Data Url
+The simplest way to define an external layer is to set the "Data Url" for a layer in QGIS (Layer Properties → QGIS Server → Data Url) to a string of these forms
+wms:<service_url>?<options>#<layername>
+wmts:<capabilities_url>?<options>#<layername>
+
+For instance:
+wms:http://wms.geo.admin.ch?tiled=false&infoFormat=application/geojson#ch.are.bauzonen
+wmts:https://wmts10.geo.admin.ch/EPSG/2056/1.0.0/WMTSCapabilities.xml#ch.swisstopo.swissboundaries3d-gemeinde-flaeche.fill
+
+Note: Support for WMTS in Data Url is currently only implemented when using qwc-docker
.
Note: You can pass parameters which control the behaviour of the WMS client in QGIS Server by prefexing the parameters with extwms.
when the layer is requested by QGIS Server, i.e. when printing. Example to override the step width/heigth of the QGIS WMS Client:
wms:http://wms.geo.admin.ch?extwms.stepWidth=4096&extwms.stepHeight=4096#ch.swisstopo.pixelkarte-farbe-pk1000.noscale
+
+Manually configuring external layers
+Rather than settin the "Data Url", you can provide a manual configuration in externalLayers
in themesConfig.json
as follows:
Entry | +Description | +
---|---|
{ |
++ |
"name": "<external_layer_name>", |
+The name of the external layer, as referenced in the theme definitions. | +
"type": "<layer_type>", |
+Layer type, "wms" or "wmts" | +
"url": "<wms_baseurl>", |
+The WMS URL or WMTS resource URL for the external layer. | +
} |
++ |
For external WMS layers, the following additional parameters apply:
+Entry | +Description | +
---|---|
"params": { |
+Parameters for the GetMap request. | +
"LAYERS": "<wms_layername>,..." , |
+WMS layer names. | +
"OPACITIES": "<0-255>,..." |
+Optional, if WMS server supports opacities. | +
}, |
++ |
"featureInfoUrl": "<wms_featureinfo_baseurl>", |
+Optional, base URL for WMS GetFeatureInfo, if different from url . |
+
"legendUrl": "<wms_legendgraphic_baseurl>" , |
+Optional, base URL for WMS GetLegendGraphic, if different from url . |
+
"queryLayers": ["<wms_featureinfo_layername>", ...], |
+Optional, list of GetFeatureInfo query layers, if different from params.LAYERS . |
+
"infoFormats": ["<featureinfo_format>", ...] |
+List of GetFeatureInfo query formats which the WMS service supports. | +
For external WMTS layers, the following additional parameters apply (you can use the qwc2/scripts/wmts_config_generator.py
script to obtain these values):
Entry | +Description | +
---|---|
"tileMatrixSet": "<tile_matrix_set_name>", |
+The name of the tile matrix set. | +
"originX": <origin_x>, |
+The X origin of the tile matrix. | +
"originY": <origin_y>, |
+The Y origin of the tile matrix. | +
"projection": "EPSG:<code>", |
+The layer projection. | +
"resolutions": [<resolution>, ...], |
+The list of WMTS resolutions. | +
"tileSize": [<tile_width>, <tile_height>] |
+The tile width and height. | +
You can specify links to display in an info-menu next to the respective theme title in the theme switcher entries.
+The format for the theme info links is as follows:
+Entry | +Description | +
---|---|
"name": "<link_name>", |
+The name of the link, as referenced in the theme definitions. | +
"title": "<link_title>", |
+The title for the link, as displayed in the info menu of the theme entry in the theme switcher. | +
"url": "<link>", |
+A link URL. | +
"target": "<link_target>" |
+The link target, i.e. _blank . |
+
Background layers are handled completely client-side and do not appear in the layer tree.
+The format of the background layer definitions is as follows:
+Entry | +Description | +
---|---|
"name": "<Name>", |
+The name of the background layer, used in the theme definitions. | +
"title": "<Title>", |
+The title of the background layer, as displayed in the background switcher. | +
"titleMsgId": "<Title msgID>", |
+Alternative to title , a message ID, translated through the translation files. |
+
"thumbnail": "<Filename>", |
+Optional, image file in assets/img/mapthumbs (see Viewer assets). Defaults to default.jpg . |
+
"type": "<Type>", |
+The background layer type, i.e. wms or wmts . |
+
"attribution": "<Attribution>", |
+Optional, attribution which will be shown in the bottom right corner of the map. | +
"attributionUrl": "<URL>", |
+Optional, link associated to the attribution | +
"group": "<GroupId>", |
+Optional, a group ID string. Background layers with the same group ID will be grouped together in the background switcher. | +
"minScale": <min_scale>, |
+Optional, minimum scale denominator from which to render the layer. | +
"maxScale": <max_scale>, |
+Optional, maximum scale denominator from which to render the layer. | +
<Layer params> |
+Parameters according to the specified layer type. Refer to the sample themesConfig.json for some examples. |
+
Note: You can use the helper python script located at qwc2/scripts/wmts_config_generator.py
to easily generate WMTS background layer configurations.
Alternatively, WMS and WMTS background layers can also be defined specifiying a resource identifier, which will then be resolved at runtime. For example:
+{
+ "name":"ch.swisstopo.pixelkarte-grau",
+ "title":"National map (gray)",
+ "resource": "wmts:https://wmts10.geo.admin.ch/EPSG/2056/1.0.0/WMTSCapabilities.xml#ch.swisstopo.pixelkarte-grau",
+ "thumbnail":"img/mapthumbs/default.jpg"
+}
+
+A background layer definition can also be a group of layers, in the format
+{
+ "name": "<Name>",
+ "title": "<Title>",
+ "type": "group",
+ "items": [
+ { <BackgroundLayerDefinition> },
+ { <BackgroundLayerDefinition> },
+ ...
+ ]
+}
+
+Instead of specifiying a full background layer definition in a group, you can also reference an existing one with "ref": "<bg_layer_name>"
, and selectively override certain properties, such as minScale
and maxScale
:
{
+ ...
+ "items": [
+ {
+ "ref": "<bg_layer_name>",
+ "minScale": <min_scale>,
+ "maxScale": <max_scale>
+ },
+ ...
+ ]
+}
+
+The file ultimately read by the QWC2 viewer is the themes.json
configuration, which includes the contents of themesConfig.json
completed with additional data obtained from the QGIS Project.
When using qwc-docker
, you can generate the themes from the qwc-admin-gui
administration backend, running on http://localhost:8088/qwc_admin by default. Log in as admin
user, then press the green Generate service configuration
button. This will invoce theqwc-config-generator
, which will generate mapViewerConfig.json
located below qwc-docker/volumes/config/<tentant>
. You can then inspect the generated themes.json
at http://localhost:8088/themes.json.
When using QWC2 as a standalone viewer, the themes.json
can be generated by invoking
yarn run themesconfig
+
+Note: this command is automatically invoked when starting the development server via yarn start
.
If working in an environment without node, using the equivalent command
+python3 qwc2/scripts/themesConfig.py
+
+If you want to manage multiple themesConfig.json
files, you can specify which while should be processed by the theme generation script via the QWC2_THEMES_CONFIG
environment variable.
When you are using qwc-docker
, you can configure QWC to read the QGIS projects directly from the database. To do this, proceed as follows:
qgisprojects
service definition for the used database to qwc-docker/pg_service.conf
.themesConfig.json
using with "url": "/ows/pg/<schema>/<projectname>"
, where schema
and projectname
as as specified when saving the project in QGIS.When using qwc-docker
, the qwc-config-generator
has the ability to split a layer that has been classified with QGIS into multiple layers and move them into a new group (the group name will be the original layer name). To activate this functionality, follow these steps:
Place the projects whose layers you want to split below qwc-docker/volumes/config-in/<tenant>/qgis_projects
.
In the topolevel config
in qwc-docker/volumes/config-in/<tenant>/tenantConfig.json
, ensure qgis_projects_gen_base_dir
is set and valid, and set "split_categorized_layers": true
.
For all layers that you want to split, create the variable convert_categorized_layer
and set it to true
.
Generate the themes configuration. The qwc-config-generator
will process the projects and write the modified projects to qgis_projects_gen_base_dir
.
Note: Make sure you are using qwc-config-generator:v<version>
and not qwc-config-generator:v<version>-noqgis
.
This chapter describes how to customize the QWC2 viewer.
+First of all, it is important to keep in mind that the QWC2 Viewer is designed to be a modular and highly customizeable application. Configuration falls into three categories:
+The qwc2-demo-app
(and the qwc-map-viewer-demo
docker image) serve as a good starting point, and for simple viewers the load-time configuration options are often sufficient to avoid the need of building a customized application.
config.json
The load-time configuration config.json
configuration file contains global viewer settings as well as the viewer plugin configuration for mobile and desktop devices. It is located as follows:
qwc-docker
: qwc-docker/volumes/config-in/<tentant>/config.json
qwc2-app/static/config.json
Refer to the sample config.json
for a concrete example.
All settings are optional, with fallback to the default values as documented.
+Setting | +Description | +
---|---|
assetsPath |
+Relative path to the assets folder. Default value: assets . |
+
translationsPath |
+Relative path to the translations folder. Default value: translations . |
+
loadTranslationOverrides |
+Whether to attempt to load tanslation overrides, see translations. Default value: false . |
+
urlPositionFormat |
+How to encode the current map extent in the URL, either centerAndZoom or extent . See URL parameters for details. Default value: extent . |
+
urlPositionCrs |
+The CRS used to encode the current map extent coordinates in the URL. Default value: the map projection. | +
omitUrlParameterUpdates |
+Whether to omit updating the URL parameters. Default value: false . |
+
defaultFeatureStyle |
+The default style to use for selection geometries and other unstyled features. Default value: see qwc2/utils/FeatureStyles.js . |
+
defaultMarkerStyle |
+The default style to use as marker icon. Default value: see qwc2/utils/FeatureStyles.js . |
+
defaultInteractionStyle |
+The default style to use on geometries to measure, snap or edit. Default value: see qwc2/utils/FeatureStyles.js . |
+
projections |
+A list of map projections to register, in the format {"code": "<code>", "proj": "<proj4def>", "label": "<label>"} . By default, EPSG:3857 and EPSG:4326 are registered. |
+
allowFractionalZoom |
+Whether to allow arbitrary scales for viewing the map. Default value: false . |
+
localeAwareNumbers |
+Whether to use locale aware numbers throughout. Default value: false . |
+
wmsHidpi |
+Whether to honour the device pixel ratio for WMS GetMap requests. Default value: true . |
+
wmsMaxGetUrlLength |
+URL length limit before switching to a POST request for GetMap and GetFeatureInfo. Default: 2048. | +
qgisServerVersion |
+The QGIS Server major version in use, defaults to 3 . |
+
defaultColorScheme |
+The color scheme to use. See Color schemes for details. | +
startupTask |
+Task to automatically aktivate on application start, in the format {key: "<Task>", "mode": "<Mode>"} . |
+
storeAllLayersInPermalink |
+Whether to store the full layertree in the permalink data, rather than only local (i.e. redlining) layers. If false , remote layers are re-queried from the respective services, if true , they are statically reloaded (meaning restored layers may be outdated compared to current service capabilities). |
+
The following options can be specified globally, and also overriden per theme, see themesConfig.json
.
+All settings are optional, with fallback to the default values as documented.
Setting | +Description | +
---|---|
preserveExtentOnThemeSwitch |
+Whether to preserve the current map extent when switching theme, if possible (see below). Default value: false . |
+
preserveBackgroundOnThemeSwitch |
+Whether to preserve the current background layer when switching theme, if possible. Default value: false . |
+
preserveNonThemeLayersOnThemeSwitch |
+Whether to preserve non-theme layers when switching theme. Default value: false . |
+
allowReorderingLayers |
+Whether to allow re-ordering layers in the layer tree. Default value: false . |
+
flattenLayerTreeGroups |
+Whether to display a flat layer tree, omitting the groups. Default value: false . |
+
allowLayerTreeSeparators |
+Allows users to add separator items in a flat layer tree. Default value: false . |
+
preventSplittingGroupsWhenReordering |
+Whether to prevent splitting sibling groups or the group itself when reordering items. Default value: false . |
+
allowRemovingThemeLayers |
+Whether to allow removing any theme layers from the layer tree. Default value: false . |
+
searchThemes |
+Whether allow searching for themes from the global search field. Default value: false . |
+
allowAddingOtherThemes |
+Whether to allow adding another theme to a currently loaded theme. Default value: false . |
+
disableImportingLocalLayers |
+Whether to hide the option to import local layers from the layer tree. Default value: false . |
+
importLayerUrlPresets |
+A list of predefined URLs from which the user can choose when importing layers from the layer tree. Entries must be strings or objects of the format {"label": "<Label>", "value": "<URL>"} . |
+
identifyTool |
+The name of the identify plugin to use. It is possible to have multiple identify tools, and i.e. on a per-theme basis select which one is active. Default value: Identify . |
+
globallyDisableDockableDialogs |
+Whether to globally disable the dockable feature of popup dialogs. Default value: false . |
+
globallyDisableMaximizeableDialogs |
+Whether to globally disable the maximizeable feature of popup dialogs. Default value: false . |
+
Note:
+allowReorderingLayers = true
and either preventSplittingGroupsWhenReordering = true
or flattenLayerTreeGroups = true
.preserveExtentOnThemeSwitch = true
, the current extent is preserved if it is within the new theme extent and if the current theme map projection is equal to the new theme projection. If preserveExtentOnThemeSwitch = "force"
, the current extent is preserved regardless of whether it is within the new theme extent, but the current and new theme map projections must still match.Some plugins require external services (typically part of the qwc-services
ecosystem). When using the qwc-docker
, these configuration entries will be automatically injected into the config.json
for enabled services.
Setting | +Description | +
---|---|
authServiceUrl |
+Typically the URL of a QWC authentication service like qwc-db-auth . |
+
editServiceUrl |
+Typically the URL of the qwc-data-service . |
+
elevationServiceUrl |
+Typically the URL of the qwc-elevation-service . |
+
mapInfoService |
+Typically the URL of the qwc-map-info-service . |
+
permalinkServiceUrl |
+Typically the URL of the qwc-permalink-service . |
+
searchServiceUrl |
+Typically the URL of the qwc-fulltext-search-service . |
+
featureReportService |
+Typically the URL of the qwc-document-service . |
+
The plugin configuration is entered as follows:
+"plugins": {
+ "common": [{<PluginConfig>}, ...],
+ "mobile": [{<PluginConfig>}, ...],
+ "desktop": [{<PluginConfig>}, ...]
+}
+
+The final mobile
and desktop
configurations will be computed by merging the common
configuration with the respective specific configuration. Each <PluginConfig>
block is of the format
Setting | +Description | +
---|---|
{ |
++ |
"name": "<name>", |
+The plugin name. | +
"cfg": {...}, |
+The plugin configuration options, see plugin reference. | +
"mapClickAction": <"identify"|"unset"|null>, |
+Optional: in case the plugin activates a viewer task, determines whether a click in the map will result in the identify tool being invoked, the task being unset, or whether no particular action should be performed (default). | +
} |
++ |
A particularly interesting aspect is the configuration of the entries in the application menu and toolbar, i.e. the entries in menuItems
and toolbarItems
in the TopBar
plugin configuration. The format of these entries is as follows:
Setting | +Description | +
---|---|
{ |
++ |
"key": "<key>", |
+The name of a plugin, i.e. LayerTree . The label for the entry will be looked up from the translations using the appmenu.items.<key> message identifier (see Managing translations). |
+
"icon": "<icon>", |
+The icon of the entry, either a built-in icon name (see below), or :/<path_to_asset> containing the path relative to assetsPath of an asset image. |
+
"themeBlacklist": ["<themename>", ...], |
+Optional, allows specifying a blacklist of theme names or titles for which the entry should not be visible. | +
"themeWhitelist": ["<themename>", ...], |
+Optional, allows specifying a whitelist of theme names or titles for which the entry should be visible. | +
"mode": "<mode>", |
+Optional, depending on the plugin, a mode can be configured to launch the plugin directly in a specific mode. For instance, the Measure plugin supports specifying the measurement mode (Point , LineString , Polygon ). |
+
"requireAuth": "<true|false>", |
+Optional, the entry is only visible when user is logged-in. | +
"shortcut": "<shortcut>" |
+Optional, keyboard shortcut which triggers the entry, i.e. "alt+shift+a" . |
+
} |
++ |
Note: The built-in icons are those located in qwc2-app/qwc2/icons
and in qwc2-app/icons
. The built-in icon names are the respective file names, without .svg
extension.
As a special case, entries for opening external URLs can be defined as follows:
+Setting | +Description | +
---|---|
{ |
++ |
"key": "<key>", |
+An arbitrary key (not used by existing plugins), used to lookup the label for the entry from the translations. | +
"icon": "<icon>", |
+As above. | +
"url": "<url>", |
+The URL to open. Can contain as placeholders the keys listed in URL Parameters, encolsed in $ (i.e. $e$ for the extent). In addition, the placeholders $x$ and $y$ for the individual map center coordinates are also supported. |
+
"target": "<target>" |
+The target where to open the URL, if empty, _blank is assumed. Can be iframe to open the link in a iframe window inside QWC2. |
+
} |
++ |
In general, the procedure for enabling a plugin is:
+plugins
section of config.json
, below common
(or mobile
and/or desktop
), add an entry{
+ "name": "<Plugin name>",
+ "cfg": {
+ <Plugin configuration props>
+ }
+}
+
+menuItems
and/or toolbarItems
as desired, i.e. "menuItems": [
+ ...
+ {"key": "<Plugin name>", "icon": "<icon name>", ...}
+ ]
+
+The viewer assets are located as follows:
+qwc2-app/static/assets
qwc-docker
: qwc-docker/volumes/qwc2/assets
The default structure of the assets folder is as follows:
+Path | +Description | +
---|---|
└─ assets/ |
+See Viewer assets | +
├─ css/ |
+Additional style sheets, must be included by index.html . |
+
│ ├─ colorschemes.css |
+Additional color schemes. | +
│ └─ qwc2.css |
+Additional style definitions. | +
├─ img/ |
+Application logo etc. | +
│ ├─ genmapthumbs/ |
+Autogenerated map thumbnails. | +
│ └─ mapthumbs/ |
+Map thumbnails. | +
├─ templates/ |
++ |
│ └─ legendprint.html |
+HTML template for the legend print. | +
├─ help.html |
+Help dialog fragment, see Help dialog. | +
└─ searchProviders.js |
+Additional search providers, see Search providers. | +
Furthermore, the application entry point index.html
is located as follows:
qwc2-app/index.html
qwc-docker
: qwc-docker/volumes/config-in/<tenant>/index.html
This file noteably specifies the application title, and references many of the assets located below the assets
folder.
The QWC2 color scheme is fully customizeable via CSS. A default color-scheme is built-in (see DefaultColorScheme.css). To define a custom color scheme, copy the default color scheme to assets/css/colorschemes.css
, add an appropriate class name to the :root
selector, and modify the colors as desided. Two additional examples (highcontrast
and dark
) are provided by default inassets/css/colorschemes.css
.
You can then modify the color scheme which is applied by default by setting defaultColorScheme
in config.json
to an appropriate class name (i.e. highcontrast
or dark
).
To change the color scheme at runtime in QWC2, make sure the Settings
plugin is enabled, and in the Settings
plugin configuration block in config.json
list the color schemes below colorSchemes
. Refer to the sample config.json
.
Note: When changing the color scheme via Settings dialog in QWC2, the picked color scheme is stored in the browser local storage, and this setting will override the defaultColorScheme
setting from config.json. Specifying the
style` URL-parameter (see URL parameters) will take precedence over all other settings.
Note: Make sure that assets/css/colorschemes.css
is included in index.html
.
Occasionally, it may be desired to customize the styling on the QWC2 components. The recommended approach is to add the corresponding style overrides to assets/css/qwc2.css
.
Note: Make sure that assets/css/qwc2.css
is included in index.html
.
The application logo in its various shapes and sizes are located below assets/img/
. In particular, the logo.svg
and logo-mobile.svg
images are displayed as in the top left corner of QWC2 in desktop and mobile mode respectively. If you'd like to use another format than SVG (while keeping logo
and logo-mobile
as base name), you can change logoFormat
in the TopBar
configuration block in config.json
.
By default, when generating the themes configuration (see [ThemesConfiguration.md#generating-theme-configuration]), a default map thumbnail is generating via WMS GetMap
, and placed below assets/img/genmapthumbs
. You can provide your own thumbnail images instead by placing the corresponding images below assets/img/mapthumbs
and referencing these as thumbnail
in you theme configuration block in themesConig.json
.
You can personalize the help dialog by providing a plain HTML document fragment in static/assets/help.html
and configuring the Help
plugin accordingly in config.json
:
{
+ "name": "Help",
+ "cfg": {
+ "bodyContentsFragmentUrl": "assets/help.html"
+ }
+}
+
+Note: $VERSION$
can be used in the HTML document fragment as a placeholder for the application build date.
The legend print template assets/templates/legendprint.html
is used when printing the map legend from the layer tree. The only requirement for this template is that is must contain a <div id="legendcontainer"></div>
element.
QWC2 is divided into two repositories:
+To build a custom viewer, the first step is cloning the demo application:
+git clone --recursive https://github.com/qgis/qwc2-demo-app.git qwc2-app
+
+The typical layout of a QWC2 app source tree is as follows:
+Path | +Description | +
---|---|
├─ static/ |
++ |
│ ├─ assets/ |
+See Viewer assets | +
│ ├─ translations/ |
+Translation files. | +
│ ├─ config.json |
+Master configuration file. | +
│ └─ themes.json |
+Full theme configuration, autogenerated from themesConfig.json . |
+
├─ js/ |
++ |
│ ├─ app.jsx |
+Entry point of the ReactJS application. | +
│ ├─ appConfig.js |
+Configuration of the qwc2 core modules. | +
│ ├─ Help.jsx |
+Built-in component of custom Help dialog, see Help dialog. | +
│ └─ SearchProviders.js |
+Built-in custom search providers, see Search providers. | +
├─ icons/ |
+Application icons. | +
├─ qwc2/ |
+Git submodule containing the core qwc2 components. | +
├─ index.html |
+Entry point. | +
├─ package.json |
+NodeJS configuration file. | +
├─ themesConfig.json |
+Themes configuration. | +
└─ webpack.config.js |
+Webpack configuration. | +
The js/appConfig.js
is the the principal build-time configuation file, and defines:
+- The default application locale, built into the application. This locale is used if no available locale matches the browser locale.
+- Which plugins are built into the application. Plugins left out here will be completely omitted when compiling the application bundle, and will hence also reduce the size of the bundle.
+- Various hook functions, as documented in the sample sample js/appConfig.js
.
Refer to the sample appConfig.js
for a concrete example.
The common application icons are located in qwc2/icons
. They can be overridden by creating an icon with the same filename in the application specific icons
folder.
Note: The icons in the icons
folder are compiled into an icon font. The icons need to be black content on transparent background, and all drawings (including texts) must be converted to paths for the icons to render correctly.
After tweaking the source files as desired, compile a deployable application bundle for production running
+yarn run prod
+
+When using qwc-docker
, copy the contents of the qwc2-app/prod
folder to qwc-docker/volumes/qwc2
and edit the qwc-docker/docker-compose.yml
to use qwc-map-viewer-base
with your custom build:
qwc-map-viewer:
+ image: sourcepole/qwc-map-viewer-base:vYYYY.MM.DD
+ environment:
+ <<: *qwc-service-variables
+ SERVICE_MOUNTPOINT: '/'
+ volumes:
+ - ./pg_service.conf:/srv/pg_service.conf:ro
+ - ./volumes/config:/srv/qwc_service/config:ro
+ - ./volumes/qwc2:/qwc2:ro
+
+As mentioned above, QWC2 is split into a common components repository and an application specific repository. The goal of this approach is to cleanly separate user-specific configuration and components which common components which serve as a basis for all QWC2 applications, and to make it as easy as possible to rebase the application onto the latest common QWC2 components.
+The recommended workflow is to keep the qwc2
folder a submodule referencing the upstream qwc2 repository. To update it, just checkout/update the desired branch:
cd qwc2
+git checkout master
+# or
+git checkout YYYY-lts
+git pull
+
+The QWC2 Upgrade Notes documents major changes, and in particular all incompatible changes between releases which require changes to the application specific code and/or configuration.
+This section gives an overview of the common tasks related to the QWC2 translations.
+By default, QWC2 will attempt to load the translation matching your browser language. Alternatively, you can explicitly specify the language by adding the lang=<lang>
query parameter to the application URL, i.e. lang=de-CH
.
The Settings
plugin furthermore allows graphically switching the language within QWC2.
When working inside a qwc2-app
source folder, the translations can be found on two levels:
qwc2-app/qwc2/translations
.qwc2-app/static/translations
.A script will take care of merging the component translations into the application translations. This way, when updating the QWC2 submodule, new translations are automatically obtained. This script is automatically invoked on yarn start
, but can also be manually invoked using
yarn run tsupdate
+
+Translations are stored inside the respective translations
folder as regular plain-text JSON files, named <lang>.json
and can be freely edited with any text editor.
The tsconfig.json
files stored inside the respective translations
folder contains the list of languages for which translations should be generated and a list of message IDs to include in the translation. The tsupdate
script will automatically scan the code for message IDs (looking for static strings passed to LocaleUtils.tr
and LocaleUtils.trmsg
), store these in tsconfig.json
and automatically create resp. update the translation files.
In some cases tsconfig.json
will not pick up a message ID (for instance, if it is computed at runtime). In these cases, the message IDs can be added manually to the extra_strings
section of the tsconfig.json
.
Also it may be desired to override a translation inherited from the QWC2 components at application level. To prevent tsupdate
from continuously reverting the overridden translation, the respective message IDs can be added to the overrides
section in the application tsconfig.json
file.
To add a new language, list it in qwc2-app/qwc2/translations/tsconfig.json
and run yarn run tsupdate
, then complete the messages taking the english translation file as reference.
When adding or modifying translations at QWC2 components level, please contribute them by submitting a pull request to the upstream qwc2 repository.
+Occasionally, it is desireable to selectively override specific translation strinsg. While one can modify the full translation file as described above, especially when using the qwc-map-viewer-demo
docker image, it is easier to just selectively override the desired translation strings and leave the original file unchanged and avoid having to compile a custom viewer (or overwriting the entire file with a docker volume mount).
To do this:
+loadTranslationOverrides
to true
in config.json
.<lang>_overrides.json
containing just the ovverridden strings, for example en-US_overrides.json
:{
+ "messages": {
+ "appmenu": {
+ "items": {
+ "LayerTree": "Layers"
+ }
+ }
+ }
+}
+
+translations
folder of your production build. When using qwc-docker
, you can place this file in qwc-docker/volumes/qwc2/translations/
and mount this file inside the container, i.e. :qwc-map-viewer:
+ image: sourcepole/qwc-map-viewer-demo:vYYYY.MM.DD
+ [...]
+ volumes:
+ - ./volumes/qwc2/translations/en-US_overrides.json:/qwc2/translations/en-US_overrides.json:ro
+
+When no translation exists for the requested language (i.e. the current browser language), QWC2 will fall back to the default translation specified as defaultLocaleData
in qwc2-app/js/appConfig.js
. For the demo viewer, the default fallback translation is en-US
.
QGIS Web Client 2 (QWC2) is a modular next generation responsive web client for QGIS Server, built with ReactJS and OpenLayers.
+ +The core concept of QWC2 is to display QGIS Projects which are published by QGIS Server via WMS.
+There are two ways to run QWC2:
+QWC2 with qwc-servies on the backend provide a complete Web GIS infrastructure.
+Without any additional services, the stock QWC2 offers the following main functionalities:
+When run as part of the qwc-services ecosystem, the following additional viewer functionalities are available:
+qwc-services also provides the following enterprise relevant functionalities:
++ +
+
++
+ +Reference to JSON schema of this config
"admin-gui"
DB connection URL
Config generator URL
Show TOTP fields for two factor authentication
Additional user fields
No Additional ItemsList of RegExes for whitelisted URLs
No Additional ItemsTimeout in seconds for proxy requests
Title displayed in Admin Gui home page
Subtitle displayed in Admin Gui home page
Solr Service base URL for collection
Solr DataImportHandler for tenant
Path to source DataImportHandler config file for tenant
Path to Solr configs
Wait time in seconds for checks during Solr index update
Max number of retries for checks during Solr index update
List of plugins to load
No Additional ItemsThe path to the input configs. Required for 'themes' and 'config_editor' plugin.
The path to QWC2 files. Required for 'themes' and 'alkis' plugins.
The path to the QGIS projects. Required for 'themes' plugin.
The path to the html info templates. Required for 'themes' plugin.
The OGC service URL path prefix, i.e. /ows. Required for 'themes' plugin.
The default Qgis server URL. Required for 'themes' plugin.
+ +
+
++
+ +Reference to JSON schema of this config
"config-generator"
Corresponds to contents of standalone QWC2 themesConfig.json
Path to themesConfig.json
Tenant name. Example: default
Connection URL for configuration database. Example: postgresql:///?service=qwc_configdb
Default QGIS Server URL for OGC requests. Example: http://qwc-qgis-server/ows/
OWS service path prefix. Defaults to the path component of defaultqgisserverurl. Used to form the urls of autodetected projects below qgisprojectsscanbase_dir. Example: /ows
Base path for QGIS projects. Example: /data
Path for QGIS projects, which should be automatically detected. Must be a subdir qgisprojectsbase_dir. Example: /data/scan
Path for generated QGIS projects, result of preprocessing. Must be a subdir of qgisprojectsbasedir. Can be the same as qgisprojectsscanbase_dir, in which case the theme autodetection will apply to generated QGIS projects. Example: /data/gen
Set whether resources are permitted or restricted by default. Example: true
Validate configuration against schema. Example: true
Target path for generated service configs and permissions, if not set by $OUTPUTCONFIGPATH. Example: /config-out
Path to the QWC2 directory, which will be used to autodetect thumbnails. If qgisprojectsscanbasedir is not set, then this option will be ignored. Example /qwc2
Skip group layers containing print layers
Layer opacity values for QGIS <= 3.10
Set to true to activate the categorize groups functionality
Timeout for GetProjectSettings, GetCapabilities and DescribeFeatureType requests. Default: 60sec
Whether to automatically generate data service datasets used for key-value relationships without requiring corresponding data resources to be created. Warning: this will expose the key and value fields of the key-value table as world readable. Default: false
Generate WFS service resources and permissions for the OGC service. Default: false
Service specific config options for generating their service configs
No Additional ItemsGenerator config for a service
Generator config for a QWC service
Service name
QWC service config options (cf. its JSON schema). This is copied unmodified to the service config.
Generator config for Map Viewer
Service name
Specific value:"mapViewer"
Additional config for generating MapViewer resources
Additional config for QWC2 application configuration
Path to QWC2 config.json file. Example: /qwc2/config.json
Path to QWC2 index.html file. Example: /qwc2/index.html
Map Viewer config options (cf. JSON schema qwc-map-viewer.json). This is copied unmodified to the service config.
Generator config for OGC service
Service name
Specific value:"ogc"
Additional config for generating OGC service resources
Additional config for WMS services
Custom OnlineResources shown in GetCapabilities
Default public base URL for OnlineResources
Public base URL for FeatureInfo OnlineResources
Public base URL for Legend OnlineResources
OGC service config options (cf. JSON schema qwc-ogc-service.json). This is copied unmodified to the service config.
+ +
+
++
+ +Reference to JSON schema of this config
"data"
Base dir where attachments are stored
Comma separated list of allowed attachment file extensions, i.e. '.png,.jpg'
Maximum attachment file size in bytes
Hostname of ClamD server listening on TCP port 3310. If set, uploaded files are checked by ClamAV
Field suffix where to log the username who last changed an upload field, i.e.
If specified, the timestamp of the last mutation to a record will be logged to the
If specified, the username of the last user who performed a mutation to a record with be logged to the
Whether to allow null geometries by default
Loopup of allowed attachment file extensions per theme, values as comma separated list, i.e. '.png,.jpg'
Lookup of maximum attachment file size in bytes per theme
The path pattern to use when saving attachments to disk. You can use {random}, {filename}, {ext} and {
PostgreSQL metadata and field constraints for a dataset
Dataset name
DB connection string for read and write access (or read-only access if dbwriteurl is present)
Optional DB connection string for write access
Dataset fields with optional constraints
No Additional ItemsField name
Spatial Reference System Identifier (EPSG code)
Allow setting geometry values to NULL
+ +
+
++
+ +Reference to JSON schema of this config
"db-auth"
DB connection URL
Min password length
Max password length
List of RegExes for additional password constraints
No Additional ItemsMin number of password_constraints to match for password to be valid
Validation message if password constraints are not met
Number of days until password expires, or -1 to disable
Show an expiry notice within this number of days before a password expires, or -1
to disable
Min number of seconds before password may be changed again, or -1 to disable
Set whether previous passwords may be reused or not
List of user info fields to include in JWT identity
No Additional ItemsURL to a logo image to show in the login form
URL to a background image for the login page
Filename of custom stylesheet placed next to regular style.css
$schema
(string): Reference to JSON schema of this config. Default: https://raw.githubusercontent.com/qwc-services/qwc-document-service/master/schemas/qwc-document-service.json
.service
(string)config
(object)jasper_service_url
(string): Jasper Reporting service URL for generating reports. Example: http://localhost:8002/reports.jasper_timeout
(integer): Timeout for requests forwarded to Jasper Reporting service. Default: 60
.resources
(object)document_templates
(array)template
(string)report_filename
(string)+ +
+
++
+ +Reference to JSON schema of this config
"elevation"
Elevation dataset (file or URL). Example: https://data.sourcepole.com/srtm1km3857.tif
+ +
+
++
+ +Reference to JSON schema of this config
"ext"
Timeout for get link requests, in seconds. Default: 10.
Timeout for post link requests, in seconds. Default: 30.
+ +
+
++
+ +Reference to JSON schema of this config
"feature-info"
Default HTML info template
Default HTML info template path
Default HTML info template in Base64 encoding
Default URL for WMS GetFeatureInfo queries
Data service URL
Transform image URLs to inline images
Whether to skip empty feature attributes in WMS GetFeatureInfo responses (default: false)
Whether to order the attributes according to order of the permitted attribute names in WMS GetFeatureInfo responses, rather than the order returned by WMS GetFeatureInfo (default: false)
WMS service with nested layers and group layers
WMS service name
Root layer of WMS (layer or group layer)
Single layer
No Additional PropertiesWMS layer name
Layer type
Specific value:"layer"
Layer title
Attribute name
Formatting expression for converting attribute values
Formatting expression for converting attribute values, in Base64 encoding
Aliases for attributes in JSON values of type list
No Additional ItemsAttribute name in JSON value
Alias for attribute in JSON value
Info template for WMS GetFeatureInfo
No Additional Properties"wms"
Custom WMS URL if different from defaultqgisserver_url
HTML template for info result
Path to HTML template for info result
HTML template for info result, in Base64 encoding
Info template for DB Query
No Additional Properties"sql"
Database connection string
Query SQL
Query SQL in Base64 encoding
HTML template for info result
Path to HTML template for info result
HTML template for info result, in Base64 encoding
Info template using WMS GetFeatureInfo
No Additional Properties"module"
Custom info module name
HTML template for info result
Path to HTML template for info result.
HTML template for info result, in Base64 encoding
Show value of this attribute in feature result header
Name of corresponding feature report
Group layer with nested sublayers
No Additional PropertiesWMS group layer name
Layer type
Specific value:"layergroup"
Group title
Sublayers of this group layer (layers or group layers)
No Additional ItemsHide sublayers of this group layer if set, to make the group layer look like a regular layer (Facade layer)
+ +
+
++
+ +Reference to JSON schema of this config
"legend"
Default base URL for forwarding WMS GetLegendGraphics requests
Path to legend images (required if using 'legend_image')
WMS service with nested layers and group layers
WMS service name
Root layer of WMS (layer or group layer)
Single layer
No Additional PropertiesWMS layer name
Layer type
Specific value:"layer"
Legend image path relative to 'legendimagespath'
Legend image in Base64 encoding
Group layer with nested sublayers
No Additional PropertiesWMS group layer name
Layer type
Specific value:"layergroup"
Sublayers of this group layer (layers or group layers)
No Additional ItemsHide sublayers of this group layer if set, to make the group layer look like a regular layer (Facade layer)
Legend image path relative to 'legendimagespath' (only if hide_sublayers is set)
Legend image in Base64 encoding (only if hide_sublayers is set)
+ +
+
++
+ +Reference to JSON schema of this config
"map-viewer"
Path to QWC2 files
QWC Auth Service URL
CCC Service URL
QWC Data Service URL
DataProduct Service URL
Document Service URL
QWC Elevation Service URL
QWC FeatureInfo Service URL
Land Register Extract Service URL
QWC Legend Service URL
MapInfo Service URL
QWC OGC Service URL
QWC Permalink Service URL
Internal QWC Permalink Service URL
PlotInfo Service URL
QWC Print Service URL
Proxy Service URL
QWC Search Result Service URL
QWC Search Service URL
Whether to insert placeholder items for restricted themes in themes.json
Whitelist of restricted theme names to include in themes.json. If empty, all restricted themes are shown.
No Additional ItemsWhether to redirect to login on auth service if requesting a restricted theme in URL params
List of user info fields to read from JWT identity
No Additional ItemsOptional: List of paths that will be accessible without a JWT identity, if AUTH_REQUIRED is set.
No Additional ItemsRestricted menu items
No Additional ItemsQWC2 application configuration (config.json)
QWC2 themes configuration (themes.json)
+ +
+
++
+ +Reference to JSON schema of this config
"mapinfo"
DB connection for info queries
Table to use
Geometry column in table
Display text column in table
Display title
Additional WHERE query
DB connection for info queries
Table to use
Geometry column in table
Display text column in table
Display title
Additional WHERE query
SQL query text
+ +
+
++
+ +Reference to JSON schema of this config
"ogc"
Default base URL for WMS/WFS requests
Regex pattern of the external OGC URL pattern, used to detect EXTERNAL_WMS URLs in print requests which point to the OGC server itself. Can use $origin$, $tenant$ and $mountpoint$ as variables. Default: $origin$/.*/?$mountpoint$
Login verification URL for requests with basic auth. Example: http://qwc-auth-service:9090/verify_login
No Additional ItemsName of the active user parameter for the QGIS Server. Will be set to the name of the logged in user in qwc2
Optional: List of paths that will be accessible without a JWT identity, if AUTH_REQUIRED is set.
No Additional ItemsOptional: Marker parameter definitions
Default value
Parameter type (number, color, string)
WMS service with nested layers and group layers
WMS service name
Custom WMS URL if different from defaultqgisserver_url
Custom OnlineResources shown in GetCapabilities
Default public base URL for OnlineResources
Public base URL for FeatureInfo OnlineResources
Public base URL for Legend OnlineResources
Root layer of WMS (layer or group layer)
Single layer
No Additional PropertiesWMS layer name
Layer type
Specific value:"layer"
Layer title
Attributes for GetFeatureInfo
No Additional ItemsWhether this layer is queryable
Custom base opacity from 0-100 (Hidden sublayers only)
Group layer with nested sublayers
No Additional PropertiesWMS group layer name
Layer type
Specific value:"layergroup"
Group title
Sublayers of this group layer (layers or group layers)
No Additional ItemsHide sublayers of this group layer if set, to make the group layer look like a regular layer (Facade layer)
Custom WMS URL for printing, e.g. if using a separate QGIS project.
Available print templates
No Additional ItemsInternal layer names used for printing and raster export of background and external layers
No Additional ItemsWFS service with list of layers
WFS service name
Custom WFS URL if different from defaultqgisserver_url
Custom OnlineResource shown in GetCapabilities
List of WFS layers
No Additional ItemsSingle layer
WFS layer name
Attributes for GetFeature and DescribeFeatureType
No Additional Items+ +
+
++
+ +Reference to JSON schema of this config
"permalink"
DB connection URL. Defaults to postgresql:///?service=qwc_configdb.
Permalink table. Defaults to qwc_config.permalinks.
User permalink table. Defaults to qwcconfig.userpermalinks.
User bookmarks table. Defaults to qwcconfig.userbookmarks.
Bookmarks sort order, defaults to "date, description".
+ +
+
++
+ +Reference to JSON schema of this config
"print"
OGC Service URL (internal)
QGIS Server version (e.g. 2.18.19, 3.4.1)
optional postfix to QGS name for printing
optional filename for returned PDF (default:
+ +
+
++
+ +Reference to JSON schema of this config
"search"
SOLR service URL
Word split Regex
Result count limit per search
Default DB connection for geometry result query
Facet name
Table/View for search result geometries
Geometry column in search result table
Facet name column in search result table
DB connection for geometry result query
+ +
+
++
+ +Reference to JSON schema of these permissions
User name
Group name
Role name
Permitted WMS services and layers for all QWC services using WMS requests (i.e. OGC, FeatureInfo, Legend, Print service)
No Additional ItemsWMS service name
Flat list of permitted layers and group layers
No Additional ItemsWMS layer name
Permitted WFS services and layers for OGC service
No Additional ItemsWFS service name
List of permitted layers
No Additional ItemsWFS layer name
Permitted datasets for Data service
No Additional ItemsDataset name
Permitted resources for custom Map viewer plugins
No Additional ItemsPlugin name
Plugin specific resources
No Additional ItemsExposes an API for interacting with QWC2 via window.qwc2
.
All following action functions are available:
+ +I.e. setCurrentTask
is available via window.qwc2.setCurrentTask
.
Additionally, the following functions are available:
+window.qwc2.addExternalLayer(resource, beforeLayerName = null)
Convenience method for adding an external layer.
+resource
: An external resource of the form wms:<service_url>#<layername>
or wmts:<capabilities_url>#<layername>
.beforeLayerName
: Insert the new layer before the layer with the specified name. If null
or the layer does not exist, the layer is inserted on top.window.qwc2.drawScratch(geomType, message, drawMultiple, callback, style = null)
Draw scratch geometries, and return these as GeoJSON to the calling application.
+geomType
: Point
, LineString
, Polygon
, Circle
or Box
.message
: A descriptive string to display in the tool taskbar.drawMultiple
: Whether to allow drawing multiple geometries.callback
: A function(result, crs)
, the result
being an array of GeoJSON features, and crs
the projection of the feature coordinates.style
: Optional, a custom style object to use for the drawn features, in the same format as DEFAULT_FEATURE_STYLE
in qwc2/utils/FeatureStyles.js
.window.qwc2.getState()
Return the current application state.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
+ | + | + | + |
Displaying the attribute table of layers in a dialog.
+To make a layer available in the attribute table, create a a data resource and matching permissions for it in the qwc-admin-gui
.
The attribute table works for both read-only as well as read-write data resources.
+This plugin queries the dataset via the editing service specified by
+editServiceUrl
in config.json
(by default the qwc-data-service
).
Property | +Type | +Description | +Default value | +
---|---|---|---|
allowAddForGeometryLayers | +bool |
+Whether to allow adding records for datasets which have a geometry column. | +undefined |
+
showEditFormButton | +bool |
+Whether to show a button to open the edit form for selected layer. Requires the Editing plugin to be enabled. | +true |
+
zoomLevel | +number |
+The zoom level for zooming to point features. | +1000 |
+
Handles authentication
+Invokes the the authentication service specified by authServiceUrl
in config.json
.
Property | +Type | +Description | +Default value | +
---|---|---|---|
clearLayerParam | +bool |
+Whether to clear the layer parameter from the URL on login. | +undefined |
+
idleTimeout | +number |
+An idle timeout in seconds after which the user is automatically logged of. | +undefined |
+
logoutTargetUrl | +string |
+An URL to redirect to on logout, instead of the viewer URL. | +undefined |
+
requireLogin | +bool |
+Whether authentication is required, i.e. the viewer automatically redirects to the login page if no user is authenticated. | +undefined |
+
Map button for switching the background layer.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
position | +number |
+The position slot index of the map button, from the bottom (0: bottom slot). | +0 |
+
Allows managing user bookmarks.
+Bookmarks are only allowed for authenticated users.
+Requires permalinkServiceUrl
to point to a qwc-permalink-service
.
Property | +Type | +Description | +Default value | +
---|---|---|---|
side | +string |
+The side of the application on which to display the sidebar. | +'right' |
+
Bottom bar, displaying mouse coordinate, scale, etc.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
displayCoordinates | +bool |
+Whether to display the coordinates in the bottom bar. | +true |
+
displayScales | +bool |
+Whether to display the scale in the bottom bar. | +true |
+
termsUrl | +string |
+The URL of the terms label anchor. | +undefined |
+
termsUrlTarget | +string |
+The target where to open the terms URL. If iframe , it will be displayed in an inline window, otherwise in a new tab. |
+undefined |
+
viewertitleUrl | +string |
+The URL of the viewer title label anchor. | +undefined |
+
viewertitleUrlTarget | +string |
+The target where to open the viewer title URL. If iframe , it will be displayed in an inline window, otherwise in a new tab. |
+undefined |
+
Cyclomedia integration for QWC2.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
apikey | +string |
+The Cyclomedia API key | +undefined |
+
clientId | +string |
+OAuth client ID. | +undefined |
+
cyclomediaVersion | +string |
+The cyclomedia version. | +'23.6' |
+
displayMeasurements | +bool |
+Whether to display Cyclomedia measurement geometries on the map. | +true |
+
geometry | +{ initialWidth: number, initialHeight: number, initialX: number, initialY: number, initiallyDocked: bool, } |
+Default window geometry. | +{ initialWidth: 480, initialHeight: 640, initialX: 0, initialY: 0, initiallyDocked: true } |
+
loginRedirectUri | +string |
+The relative path to the redirect login handling of oauth. | +undefined |
+
logoutRedirectUri | +string |
+The relative path to the redirect logout handling of oauth. | +undefined |
+
maxMapScale | +number |
+The maximum map scale above which the recordings WFS won't be displayed. | +10000 |
+
projection | +string |
+The projection to use for Cyclomedia. | +'EPSG:3857' |
+
Allows exporting a selected extent of the map as DXF.
+Uses the DXF format support of QGIS Server.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
formatOptions | +string |
+Optional format options to pass to QGIS Server via FORMAT_OPTIONS. | +undefined |
+
layerOptions | +[{ label: string, layers: string, }] |
+Optional choice of layer sets to pass to QGIS Server via LAYERS. | +undefined |
+
serviceUrl | +string |
+Optional URL invoked on export instead of the default QGIS Server URL. | +undefined |
+
Allows editing geometries and attributes of datasets.
+The attribute form is generated from the QGIS attribute form configuration.
+This plugin queries the dataset via the editing service specified by
+editServiceUrl
in config.json
(by default the qwc-data-service
).
Property | +Type | +Description | +Default value | +
---|---|---|---|
allowCloneGeometry | +bool |
+Whether to enable the "Clone existing geometry" functionality. | +true |
+
side | +string |
+The side of the application on which to display the sidebar. | +'right' |
+
snapping | +bool |
+Whether snapping is available when editing. | +true |
+
snappingActive | +bool |
+Whether snapping is enabled by default when editing. | +true |
+
width | +string |
+The default width of the editing sidebar, as a CSS width string. | +"30em" |
+
Displays queried feature attributes in a form.
+The attribute form is generated from the QGIS attribute form configuration.
+If the dataset it editable, allows editing the attributes directly in the +displayed form.
+This plugin queries the feature via the editing service specified by
+editServiceUrl
in config.json
(by default the qwc-data-service
), rather than over WMS
+GetFeatureInfo like the Identify
plugin.
Can be used as default identify tool by setting "identifyTool": "FeatureForm"
in config.json
.
Property | +Type | +Description | +Default value | +
---|---|---|---|
initialHeight | +number |
+Initial height of the form window. | +480 |
+
initialWidth | +number |
+Initial width of the form window. | +320 |
+
initialX | +number |
+Initial x position of the form window. | +0 |
+
initialY | +number |
+Initial y position of the form window. | +0 |
+
Displays a height profile along a measured line.
+Triggered automatically when a line is measured via the Measure
plugin.
Requires elevationServiceUrl
in config.json
to point to a qwc-elevation-service
.
Property | +Type | +Description | +Default value | +
---|---|---|---|
heighProfilePrecision | +number |
+The precision of displayed and exported values (0: no decimals, 0.1: 1 decimal position, etc). | +0 |
+
height | +number |
+The height of the height profile widget in pixels. | +100 |
+
samples | +number |
+The number of elevation samples to query. | +500 |
+
Displays a custom help dialog in a sidebar.
+Define the help contents by specifying the bodyContentsFragmentUrl
prop.
Property | +Type | +Description | +Default value | +
---|---|---|---|
bodyContentsFragmentUrl | +string |
+URL to a document containing a HTML fragment to display in the Help sidebar. | +undefined |
+
side | +string |
+The side of the application on which to display the sidebar. | +'right' |
+
Map button for reverting to the home extent of the theme.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
position | +number |
+The position slot index of the map button, from the bottom (0: bottom slot). | +5 |
+
Displays queried feature attributes.
+Uses WMS GetFeatureInfo to query features and displays the result in +table, as a HTML fragment or as plain text based on the supported GetFeatureInfo +format.
+Extendable in combination with the qwc-feature-info-service
, which provides support
+for customized queries and templates for the result presentation.
Property | +Type | +Description | +Default value | +
---|---|---|---|
attributeCalculator | +func |
+Optional function for computing derived attributes. See js/IdentifyExtensions.js for details. This prop can be specified in the appConfig.js cfg section. | +undefined |
+
attributeTransform | +func |
+Optional function for transforming attribute values. See js/IdentifyExtensions.js for details. This prop can be specified in the appConfig.js cfg section. | +undefined |
+
clearResultsOnClose | +bool |
+Whether to clear the identify results when exiting the identify tool. | +true |
+
customExporters | +array |
+Optional list of custom exporters to offer along with the built-in exporters. See js/IdentifyExtensions.js for details. This prop can be specified in the appConfig.js cfg section. | +[] |
+
displayResultTree | +bool |
+Whether to display a tree overview of results (as opposed to a flat list of results). | +true |
+
enableExport | +bool |
+Whether to enable the export functionality. | +true |
+
featureInfoReturnsLayerName | +bool |
+Whether to assume that XML GetFeatureInfo responses specify the technical layer name in the name attribute, rather than the layer title. |
+true |
+
initialHeight | +number |
+The initial height of the identify dialog. | +320 |
+
initialWidth | +number |
+The initial width of the identify dialog. | +240 |
+
initialX | +number |
+The initial x coordinate of the identify dialog. | +0 |
+
initialY | +number |
+The initial y coordinate of the identify dialog. | +0 |
+
initiallyDocked | +bool |
+Whether the identify dialog should be initially docked. | +undefined |
+
replaceImageUrls | +bool |
+Whether to replace an attribute value containing an URL to an image with an inline image. | +true |
+
Displays a pre-configured catalog of external layers in a window.
+Configured through a catalog JSON containing a tree of external layer identifiers.
+Example:
+{
+ "catalog": [
+ {
+ "title": "Bauzonen",
+ "resource": "wms:http://wms.geo.admin.ch#ch.are.bauzonen"
+ },
+ {
+ "title": "Gewässerschutz",
+ "resource": "wms:https://geo.so.ch/api/wms#ch.so.afu.gewaesserschutz[50]"
+ },
+ {
+ "title": "Landeskarten",
+ "sublayers": [
+ {
+ "title": "Landeskarte 1:1 Million | LK1000",
+ "resource": "wms:http://wms.geo.admin.ch#ch.swisstopo.pixelkarte-farbe-pk1000.noscale"
+ },
+ {
+ "title": "Landeskarte 1:100`000 | LK100",
+ "resource": "wms:http://wms.geo.admin.ch#ch.swisstopo.pixelkarte-farbe-pk100.noscale"
+ }
+ ]
+ }
+ ]
+}
+
+Property | +Type | +Description | +Default value | +
---|---|---|---|
catalogUrl | +string |
+The URL to the catalog JSON file. | +undefined |
+
windowSize | +{ width: number, height: number, } |
+The default window size. | +{width: 320, height: 320} |
+
Displays the map layer tree in a sidebar.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
addLayerSeparator | +func |
+Whether to allow adding separator entries in the layer tree, useful for organizing the tree. | +undefined |
+
allowCompare | +bool |
+Whether to enable the compare function. Requires the MapCompare plugin. |
+true |
+
allowImport | +bool |
+Whether to allow importing external layers. | +true |
+
allowMapTips | +bool |
+Whether to allow enabling map tips. | +true |
+
bboxDependentLegend | +{bool, string} |
+Whether to display a BBOX dependent legend. Can be true|false|"theme" , latter means only for theme layers. |
+false |
+
enableLegendPrint | +bool |
+Whether to enable the legend print functionality. | +true |
+
enableServiceInfo | +bool |
+Whether to display a service info button to display the WMS service metadata. | +true |
+
enableVisibleFilter | +bool |
+Whether to display a button to filter invisible layers from the layertree. | +true |
+
extraLegendParameters | +string |
+Additional parameters to pass to the GetLegendGraphics request- | +undefined |
+
flattenGroups | +bool |
+Whether to display a flat layer tree, omitting any groups. | +false |
+
grayUnchecked | +bool |
+Whether to display unchecked layers gray in the layertree. | +true |
+
groupTogglesSublayers | +bool |
+Whether toggling a group also toggles all sublayers. | +false |
+
infoInSettings | +bool |
+Whether to display the layer info button inside the layer settings menu rather than next to the layer title. | +true |
+
layerInfoWindowSize | +{ width: number, height: number, } |
+The initial size of the layer info window. | +{width: 320, height: 480} |
+
mapTipsEnabled | +bool |
+Whether map tips are enabled by default. | +undefined |
+
scaleDependentLegend | +{bool, string} |
+Whether to display a scale dependent legend. Can be true|false|"theme" , latter means only for theme layers. |
+undefined |
+
showLegendIcons | +bool |
+Whether to display legend icons. | +true |
+
showQueryableIcon | +bool |
+Whether to display the queryable icon to indicate that a layer is identifyable. | +true |
+
showRootEntry | +bool |
+Whether to display the root entry of the layertree. | +true |
+
showToggleAllLayersCheckbox | +bool |
+Whether to display a checkbox to toggle all layers. | +true |
+
side | +string |
+The side of the application on which to display the sidebar. | +'right' |
+
width | +string |
+The initial width of the layertree, as a CSS width string. | +"25em" |
+
Map button for controling the locate (GPS) state.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
position | +number |
+The position slot index of the map button, from the bottom (0: bottom slot). | +2 |
+
Displays the currently logged in user.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
+ | + | + | + |
The main map component.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
mapOptions | +{ zoomDuration: number, enableRotation: bool, rotation: number, panStepSize: number, panPageSize: number, } |
+Zoom duration in ms, rotation in degrees, panStepSize and panPageSize as fraction of map width/height. | +{} |
+
showLoading | +bool |
+Whether to display the loading spinner when layers are loading. | +true |
+
swipeGeometryTypeBlacklist | +[string] |
+A list of layer geometry types to ignore when determining the top-most layer to compare. | +[] |
+
swipeLayerNameBlacklist | +[string] |
+A list of layer names to ignore when determining the top-most layer to compare. You can use * as a whildcard character. |
+[] |
+
toolsOptions | +object |
+Map tool configuraiton options. Refer to the sample config.json. | +{} |
+
Allows comparing the top layer with the rest of the map.
+Activated through a checkbox in the LayerTree.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
+ | + | + | + |
Displays layer attributions in the bottom right corner of the map.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
prefixCopyrightsWithLayerNames | +bool |
+Whether to prepend the layer name to the attribution string. | +undefined |
+
showThemeCopyrightOnly | +bool |
+Whether to only display the attribution of the theme, omitting external layers. | +undefined |
+
Provides map context information when right-clicking on the map.
+Displays the coordinates at the picked position by default.
+If elevationServiceUrl
in config.json
to points to a qwc-elevation-service
,
+the height at the picked position is also displayed.
If mapInfoService
in config.json
points to a qwc-mapinfo-service
, additional
+custom information according to the qwc-mapinfo-service
configuration is returned.
Property | +Type | +Description | +Default value | +
---|---|---|---|
cooPrecision | +number |
+The number of decimal places to display for metric/imperial coordinates. | +0 |
+
degreeCooPrecision | +number |
+The number of decimal places to display for degree coordinates. | +4 |
+
elevationPrecision | +number |
+The number of decimal places to display for elevation values. | +0 |
+
Displays the map legend in a floating dialog.
+The user can toggle whether to display only layers which are enabled, visible in the current extent and/or visible at the current scale.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
addGroupTitles | +bool |
+Whether to add group titles to the legend. | +false |
+
addLayerTitles | +bool |
+Whether to add layer titles to the legend. Note that often the legend image itself already contains the layer title. | +false |
+
bboxDependentLegend | +bool |
+Whether to display a BBOX-dependent legend by default. | +false |
+
extraLegendParameters | +string |
+Extra parameters to add to the GetLegendGraphics request. | +undefined |
+
onlyVisibleLegend | +bool |
+Whether to only include enabled layers in the legend by default. | +false |
+
scaleDependentLegend | +bool |
+Whether to display a scale-dependent legend by default. | +false |
+
windowSize | +{ width: number, height: number, } |
+The default window size. | +{width: 320, height: 320} |
+
Displays maptips by hovering over features on the map.
+Queries the map tips configured in the QGIS layer properites over GetFeatureInfo.
+The map tip needs to be configured in QGIS Layer Properties → Display.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
layerFeatureCount | +number |
+The maximum number of feature maptips to display for a single layer. | +5 |
+
Allows measuring points/lines/areas on the map.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
showMeasureModeSwitcher | +bool |
+Whether to show the widget to switch between measure modes. | +true |
+
snapping | +bool |
+Whether snapping is available when editing. | +true |
+
snappingActive | +bool |
+Whether snapping is enabled by default when editing. | +true |
+
Displays a newsletter in a popup dialog.
+The popup won't be dispayed anymore, if the user chooses so, until a newer +revision is published (specified via newsRev prop).
+Property | +Type | +Description | +Default value | +
---|---|---|---|
newsDocument | +string |
+URL to the news HTML document to display in the popup. | +undefined |
+
newsRev | +string |
+Revision of the document. | +undefined |
+
Invokes QGIS Server WMS GetPrint to print the map to PDF.
+Uses the print layouts defined in the QGIS project.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
allowGeoPdfExport | +bool |
+Whether to allow GeoPDF export. Requires QGIS Server 3.32 or newer. | +undefined |
+
defaultDpi | +number |
+The default print dpi. | +300 |
+
defaultScaleFactor | +number |
+The factor to apply to the map scale to determine the initial print map scale. | +0.5 |
+
displayRotation | +bool |
+Whether to display the map rotation control. | +true |
+
gridInitiallyEnabled | +bool |
+Whether the grid is enabled by default. | +false |
+
hideAutopopulatedFields | +bool |
+Whether to hide form fields which contain autopopulated values (i.e. search result label). | +undefined |
+
inlinePrintOutput | +bool |
+Whether to display the print output in an inline dialog instead triggering a download. | +false |
+
printExternalLayers | +bool |
+Whether to print external layers. Requires QGIS Server 3.x! | +true |
+
scaleFactor | +number |
+Scale factor to apply to line widths, font sizes, ... of redlining drawings passed to GetPrint. | +1.9 |
+
side | +string |
+The side of the application on which to display the sidebar. | +'right' |
+
Adds support for displaying notifications of background processes.
+Only useful for third-party plugins which use this functionality.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
+ | + | + | + |
Allows exporting a selected portion of the map to an image ("screenshot").
+Property | +Type | +Description | +Default value | +
---|---|---|---|
allowedFormats | +[string] |
+Whitelist of allowed export format mimetypes. If empty, supported formats are listed. | +undefined |
+
allowedScales | +[number] |
+List of scales at which to export the map. | +undefined |
+
defaultFormat | +string |
+Default export format mimetype. If empty, first available format is used. | +undefined |
+
defaultScaleFactor | +number |
+The factor to apply to the map scale to determine the initial export map scale. | +0.5 |
+
dpis | +[number] |
+List of dpis at which to export the map. If empty, the default server dpi is used. | +undefined |
+
exportExternalLayers | +bool |
+Whether to include external layers in the image. Requires QGIS Server 3.x! | +true |
+
pageSizes | +[{ name: string, width: number, height: number, }] |
+List of image sizes to offer, in addition to the free-hand selection. The width and height are in millimeters. | +[ {name: '15 x 15 cm', width: 150, height: 150}, {name: '30 x 30 cm', width: 300, height: 300} ] |
+
side | +string |
+The side of the application on which to display the sidebar. | +'right' |
+
Allows drawing figures and text labels on the map.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
allowGeometryLabels | +bool |
+Whether to allow labeling geometric figures. | +true |
+
snapping | +bool |
+Whether snapping is available when editing. | +true |
+
snappingActive | +bool |
+Whether snapping is enabled by default when editing. | +true |
+
Compute routes and isochrones.
+Requites routingServiceUrl
in config.json
pointing to a Valhalla routing service.
Property | +Type | +Description | +Default value | +
---|---|---|---|
enabledModes | +[string] |
+List of enabled routing modes. | +["auto", "heavyvehicle", "transit", "bicycle", "pedestrian"] |
+
enabledProviders | +[string] |
+List of search providers to use for routing location search. | +["coordinates", "nominatim"] |
+
geometry | +{ initialWidth: number, initialHeight: number, initialX: number, initialY: number, initiallyDocked: bool, } |
+Default window geometry. | +{ initialWidth: 320, initialHeight: 640, initialX: 0, initialY: 0, initiallyDocked: true } |
+
Task which which can be invoked by other tools to draw a geometry and pass it to a callback.
+Only useful for third-party code, i.e. over the JavaScript API.
+Invoke as setCurrentTask("ScratchDrawing", null, null, {callback: <function(features, crs)>});
Property | +Type | +Description | +Default value | +
---|---|---|---|
+ | + | + | + |
Settings panel.
+Allows configuring language and color scheme.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
colorSchemes | +[{ title: string, titleMsgId: string, value: string, }] |
+List of available color schemes. Value is the css class name, title/titleMsgId the display name. | +[] |
+
languages | +array |
+List of available languages. Value is the lang code, title/titleMsgId the display name. | +[] |
+
side | +string |
+The side of the application on which to display the sidebar. | +'right' |
+
Share the current map as a URL/permalink.
+Compact permalinks will be generated if permalinkServiceUrl
in config.json
points to a qwc-permalink-service
.
Property | +Type | +Description | +Default value | +
---|---|---|---|
showLink | +bool |
+Show the map URL. | +true |
+
showQRCode | +bool |
+Show the QR code of the map URL. | +true |
+
showSocials | +{bool, [string]} |
+Show the social buttons. Either true or false to enable/disable all, or an array of specific buttons to display (possible choices: email , facebook , twitter , linkedin , whatsapp ). |
+true |
+
side | +string |
+The side of the application on which to display the sidebar. | +'right' |
+
Displays a marker when starting up the viewer.
+The marked is displayed in the center of the map if c=<x>,<y>&hc=1
is set in the URL.
Property | +Type | +Description | +Default value | +
---|---|---|---|
removeMode | +string |
+When to remove the marker. Possible choices: onpan, onzoom, onclickonmarker. | +'onpan' |
+
Generic map button to launch a task.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
icon | +string |
+The icon name. | +undefined |
+
mode | +string |
+The task mode. | +undefined |
+
position | +number |
+The position slot index of the map button, from the bottom (0: bottom slot). | +1 |
+
task | +string |
+The task name. | +undefined |
+
Theme switcher panel.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
collapsibleGroups | +bool |
+Whether to allow collapsing theme groups. | +undefined |
+
showLayerAfterChangeTheme | +bool |
+Whether to show the LayerTree by default after switching the theme. | +false |
+
side | +string |
+The side of the application on which to display the sidebar. | +'right' |
+
themeLayersListWindowSize | +{ width: number, height: number, } |
+The default window size for the theme layers dialog. | +{width: 400, height: 300} |
+
width | +string |
+Default width as a CSS string. | +"50%" |
+
Allows controling the time dimension of temporal WMS layers.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
cursorFormat | +string |
+The format of the time cursor label. Either date , time or datetime . |
+"datetime" |
+
dateFormat | +string |
+The date format in the time controls, i.e. YYYY-MM-DD. | +"YYYY-MM-DD[\n]HH:mm:ss" |
+
defaultAnimationInterval | +number |
+The default interval for the temporal animation, in seconds. | +1 |
+
defaultEnabled | +bool |
+Default for TimeManager enabled when loading application. true or false |
+false |
+
defaultFeatureCount | +number |
+The default number of features that will be requested. | +100 |
+
defaultStepSize | +number |
+The default step size for the temporal animation, in step units. | +1 |
+
defaultStepUnit | +string |
+The default step unit for the temporal animation, one of ms , s , m , d , M , y , 10y , 100y |
+"d" |
+
defaultTimelineDisplay | +string |
+The default timeline display mode. One of hidden , minimal , features , layers . |
+undefined |
+
defaultTimelineMode | +string |
+The default timeline mode. One of fixed , infinite . |
+"fixed" |
+
markerConfiguration | +{ markersAvailable: bool, gradient: [string], markerOffset: array, markerPins: bool, } |
+The feature marker configuration. | +{ markersAvailable: true, gradient: ["#f7af7d", "#eacc6e", "#fef89a", "#c5e09b", "#a3d29c", "#7cc096", "#79c8c5", "#34afce"], markerOffset: [0, 0], markerPins: true } |
+
stepUnits | +[string] |
+The available temporal anumation step units. | +["s", "m", "h", "d", "M", "y"] |
+
Top bar, containing the logo, searchbar, task buttons and app menu.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
appMenuClearsTask | +bool |
+Whether opening the app menu clears the active task. | +undefined |
+
appMenuFilterField | +bool |
+Whether to display the filter field in the app menu. | +undefined |
+
appMenuShortcut | +string |
+The shortcut for tiggering the app menu, i.e. alt+shift+m. | +undefined |
+
appMenuVisibleOnStartup | +bool |
+Whether to open the app menu on application startup. | +undefined |
+
logoFormat | +string |
+The logo file format. | +"svg" |
+
logoSrc | +string |
+The logo image URL if a different source than the default assets/img/logo. |
+undefined |
+
logoUrl | +string |
+The hyperlink to open when the logo is clicked. | +undefined |
+
menuItems | +array |
+The menu items. Refer to the corresponding chapter of the viewer documentation and the sample config.json. | +[] |
+
searchOptions | +object |
+Options passed down to the search component. See the searchOption propType of the used search component. | +{} |
+
toolbarItems | +array |
+The toolbar. Refer to the corresponding chapter of the viewer documentation and the sample config.json. | +[] |
+
toolbarItemsShortcutPrefix | +string |
+The keyboard shortcut prefix for triggering toolbar tasks. I.e. alt+shift. The task are then triggered by |
+undefined |
+
Map button for zooming the map.
+Two specific plugins exist: ZoomInPlugin and ZoomOutPlugin, which are instances of ZoomButton for the respective zoom directions.
+Property | +Type | +Description | +Default value | +
---|---|---|---|
position | +number |
+The position slot index of the map button, from the bottom (0: bottom slot). | +undefined |
+
This document describes incompatibilites and other aspects which QWC2 applications need to address when updating against the latest qwc2 submodule.
+When updating the qwc2
submodule, run yarn install
to ensure the dependencies are up to date!
MapInfoToolTip plugin instantation change
+The instantation of the MapInfoToolTip
in appConfig.js
needs to be changed to
MapInfoTooltipPlugin: MapInfoTooltipPlugin(),
+Note the extra braces at the end. As a new feature, you can pass a list of plugins to the MapInfoTooltipPlugin
.
Configuration changes
+geometry
config prop (rather than occasionally windowSize
before). Affected plugins are: FeatureForm
, Identify
, LayerCatalog
, LayerTree
, MapLegend
. Please check the respective plugin reference for more details on the new format.Config setting change
+config.json
via geodesicMeasurements: true|false
rather than below Map -> cfg -> toolsOptions -> MeasurementSupport
.Dependency update
+Most dependencies have been updated to the latest version. The following adjustments need to be performed by hand:
+createRoot
in app.jsx
, see the demo app.jsx
.Update uuid
imports in external components, examples:
import {v1 as uuidv1} from 'uuid'; + import {v4 as uuidv4} from 'uuid';
+and then instead of uuid.v1()
use uuidv1()
etc.
Adjust webpack.config.js
from
{ + test: /.mjs$/, + type: 'javascript/auto' + }
+to
+ {
+ test: /(.mjs|.js)$/,
+ type: 'javascript/auto'
+ }
+
+Reworked search provider support
+The arguments and expected behaviour of the provider onSearch
and getResultGeometry
have changed. Please refer to the documentation chapter in the Documentation. Consult js/SearchProviders.js and static/assets/searchProviders.js for full examples.
It is now possible to define search providers in a external JS file loaded at runtime rather than compiled into the application bundle. See static/assets/searchProviders.js, which is loaded by index.html.
+js/SearchProviders.js
now only includes coordinates
and nominatim
as built-in search providers for the demo application.
The searchProviderFactory
function has been removed from js/SearchProviders.js
. Instead, custom parameters to be passed to a provider can be specified directly in the theme item searchProviders
entry:
{
+ key: "<providerkey2>",
+ params: {...}
+}
+
+and read from searchParams.cfgParams
in the provider onSearch
function.
Load Help dialog contents from HTML fragment
+Instead of requiring users to implement the renderHelp
function in js/Help.jsx
, for simple cases the users can provide a plain HTML fragment which is loaded at runtime from the assets. Consult the Documentation.
Reworked color scheme support
+The styleConfig.js
file is deprecated and won't be honoured anymore for the styling of core QWC2 components. Instead, base theme colors can be defined via CSS, refer to documentation for details.
Renamed config variable
+The maxGetUrlLength
variable in config.json
has been renamed to wmsMaxGetUrlLength
.
Reworked interface for handling 1:N relations between qwc2 and qwc-data-service
+The interface for reading and writing 1:n relations between the qwc2 and the qwc-data-service was reworked. If you are using the qwc-data-service, make sure to update to qwc-data-service-v2022.06.27 or later when updating to qwc2 submodule revision e357152 or later.
+Refactoring of editing components
+The editing components have been heavily refactored internally. The changes are mostly transparent, but two points are important:
+editDataset
field of an editConfig
entry is now mandatory. editConfig
s generated by qwc-config-generator already write this field, so this applies only to manually written editConfig
s for use outside of qwc-services.changeEditingState
action has been replaced by setEditContext
(and clearEditContext
). This allows for storing and switching between multiple edit contexts in the application state. Custom components interacting with editing also should be changed to verify that the current edit context is the desired one.Format change for external layer resource strings
+For a short period of time (after submodule revision cb870a1), QWC2 supported external resource strings in the form wms:<service_url>#<layername>?<options>
. The format has been changed to
wms:<service_url>?<options>#<layername>
+
+i.e. by moving the query portion before the hash portion, which is inline with the URL scheme format.
+Update to Webpack 5, React 17
+webpack.config.js
and the dependencies and package scripts from the demo app package.json
. Note that the build
package script is now an alias with the prod
script.dist/App.js
script include from index.html
, it is now added automatically by Webpack.static
folder, which will contain assets
, translations
, config.json
, themes.json
, etc. The themesConfig
script will write themes.json
to that folder.In custom components, replace any use of Swipeable
from react-swipeable
:
Reworked Identify plugin
+The Identify plugin has been completely reworked, and the IdentifyRegion plugin has been merged into the Identify plugin:
+js/appConfig.js
and config.json
Create menu/toolbar entries in config.json for the region identify tool mode by specifying "mode": "Region"
, i.e.:
{"key": "Identify", "icon": "identify_region", "mode": "Region"},
+The translation message id identifyregion.info
has been changed to infotool.clickhelpPolygon
(unless the string is overridden, yarn run tsupdate
will take care of this automatically).
Updated dependencies
+Many dependencies in the qwc2
submodule have been update, please run yarn install
to update them in your application.
In the demo app, also many dependencies in the application package.json
have been updated.
+It's recommended to synchronize the application package.json
and webpack.config.js
with the ones of the demo app.
Plugins do not need to specify the reducers they use anymore
+Action files register now the reducers they use automatically, so whenever a symbol is imported from an action file, the respective reducer is automatically enabled.
+If you have a custom action/reducer file outside the qwc2
submodule folder (i.e. js/{actions,reducers}/myfunctionality.js
), you should add lines similar to
import ReducerIndex from 'qwc2/reducers/index';
+import myfunctionalityReducer from '/reducers/myfunctionality';
+ReducerIndex.register("myfunctionality", myfunctionalityReducer);
+
+to js/actions/myfunctionality.js
.
If you have custom QWC2 plugins, remove the reducers
field of the plugin export.
ES6 imports
+QWC2 now uses the ES6 import/export syntax throughout. For instance
+const Icon = require('qwc2/components/Icon');
+const {addLayer} = require('qwc2/actions/layers');
+
+become
+import Icon from 'qwc2/components/Icon';
+import {addLayer} from 'qwc2/actions/layers';
+
+And
+module.exports = MyClass;
+
+becomes
+export default MyClass;
+
+resp.
+function foo() {...};
+function bar() {...};
+module.exports = {foo, bar};
+
+becomes
+export function foo() {...};
+export function bar() {...};
+
+In particular, js/appConfig.js
needs to be heavily adapted.
Update to React 16.14
+As per React 16.3, various component lifecycle methods have been deprecated. +All qwc2 core components are updated to avoid their use. Custom components should also be updated. +See https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html for details.
+Reworked localization
+Localization in QWC2 has been reworked:
+- Instead of <Message msgId="<msgid>" />
and LocaleUtils.getMessageById()
, use LocaleUtils.tr(<msgid>)
.
+- For message IDs which are not translated directly via LocaleUtils.tr
, use LocaleUtils.trmsg
to mark the string as a message ID.
+- The Message
component has been dropped.
+- Static message IDs are now picked up automatically by updateTranslations.js
(invoked by yarn run tsupdate
).
+- Message IDs built at runtime will beed to be specified manually in tsconfig.json
in the extra_strings
section.
+- The translation files are now called translations/<lang>-<COUNTRY>.json
rather than translations/data.<lang>-<COUNTRY>
. The format of the files remains unchanged.
+- The supportedLocales
section in appConfig.js
needs to be dropped.
+- Previously, the fallback locale was specified as fallbacklocale
in config.json. Now, it must be specified as defaultLocaleData
in appConfig.js
.
Default editing interface now shipped in the qwc2 submodule
+The js/EditingInterface.js
in the demo app has been moved to qwc2/utils/EditingInterface.js
.
+This is the interface which acts as a counterpart to the QWC data service.
+If you want to use a custom editing interface, you can still do so, passing it to the Editing
plugin in appConfig.js
as before.
Assets and translations path now optional
+Assets and translations path can now be omitted from the config.json
, and are resolved to assets
resp translations
relative to the index.html
path of the QWC2 application by default.
Use ConfigUtils.getAssetsPath()
and ConfigUtils.getTranslationsPath()
in your custom components instead of ConfigUtils.getConfigProp
.
You can still specify assetsPath
and translationsPath
in config.json
to override the default values.
Changes to map click point/feature state
+The previous state.map.clickPoint
and state.map.clickFeature
have been merged to a single state.map.click
. The clickFeatureOnMap
action has been removed.
The qwc-uwsgi-base
images have been changed to allow for configurable UID/GID of the uwsgi
process. The default is UID=33
and GID=33
, you can override it by setting the SERVICE_UID
and SERVICE_GID
environment variables in docker-compose.yml
.
As a consequence, /var/www
is not necessarily anymore the home directory of the user wich runs uwsgi
, and therefore the qwc-uwsgi-base
images now set ENV PGSERVICEFILE="/srv/pg_service.conf"
. You'll therefore need to adapt your pg_service.conf
volume mounts in your docker-compose.yml
to point to that location, i.e.
[...]
+- ./pg_service.conf:/srv/pg_service.conf:ro
+[...]
+
+scanned_projects_path_prefix
has been dropped as a config setting. Instead, qgis_projects_scan_base_dir
must be a directory below qgis_projects_base_dir
, and the prefix is automatically computed internally.scanned_projects_path_prefix
has been added as a config setting as the output path for preprocessed qgis projects. It must be a directory below qgis_projects_base_dir
to which the config service is allowed to write.Starting with v2022.01.08, the requirements of all services where updated to use Flask-JWT-Extended 4.3.1.
+Flask-JWT-4.x changes the JWT format (see 4.0.0 Breaking Changes), which can result in QWC Services returning a Missing claim: identity
error message.
To avoid this:
+* Change your JWT secret key in .env
.
+* Ensure all services are upgraded to v2022.01.12 or later (if such a version exists). Please omit v2022.01.08 and v2022.01.11.
' + escapeHtml(summary) +'
' + noResultsText + '
'); + } +} + +function doSearch () { + var query = document.getElementById('mkdocs-search-query').value; + if (query.length > min_search_length) { + if (!window.Worker) { + displayResults(search(query)); + } else { + searchWorker.postMessage({query: query}); + } + } else { + // Clear results for short queries + displayResults([]); + } +} + +function initSearch () { + var search_input = document.getElementById('mkdocs-search-query'); + if (search_input) { + search_input.addEventListener("keyup", doSearch); + } + var term = getSearchTermFromLocation(); + if (term) { + search_input.value = term; + doSearch(); + } +} + +function onWorkerMessage (e) { + if (e.data.allowSearch) { + initSearch(); + } else if (e.data.results) { + var results = e.data.results; + displayResults(results); + } else if (e.data.config) { + min_search_length = e.data.config.min_search_length-1; + } +} + +if (!window.Worker) { + console.log('Web Worker API not supported'); + // load index in main thread + $.getScript(joinUrl(base_url, "search/worker.js")).done(function () { + console.log('Loaded worker'); + init(); + window.postMessage = function (msg) { + onWorkerMessage({data: msg}); + }; + }).fail(function (jqxhr, settings, exception) { + console.error('Could not load worker.js'); + }); +} else { + // Wrap search in a web worker + var searchWorker = new Worker(joinUrl(base_url, "search/worker.js")); + searchWorker.postMessage({init: true}); + searchWorker.onmessage = onWorkerMessage; +} diff --git a/search/search_index.json b/search/search_index.json new file mode 100644 index 00000000..48071e97 --- /dev/null +++ b/search/search_index.json @@ -0,0 +1 @@ +{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"QWC2 / QWC Services QGIS Web Client 2 (QWC2) is a modular next generation responsive web client for QGIS Server, built with ReactJS and OpenLayers. The core concept of QWC2 is to display QGIS Projects which are published by QGIS Server via WMS. There are two ways to run QWC2: As part of the qwc-services ecosystem, includes additional services to which includes additional services to extend the viewer functionality (such as user administration, editing, etc.). This is the recommended approach. As a standalone viewer (static JS/HTML/CSS web application) on top of QGIS Server. QWC2 with qwc-servies on the backend provide a complete Web GIS infrastructure. Overview of functionalities Without any additional services, the stock QWC2 offers the following main functionalities: Theme switcher (a theme is a published QGIS project) Switchable background layers Layer tree Object information (feature info) Search with configurable providers Measurement tools Redlining (sketching) URL sharing Geolocation PDF printing Raster and DXF export Compare layers Import external layers (WMS, WFS, WMTS, KML, GeoJSON) When run as part of the qwc-services ecosystem, the following additional viewer functionalities are available: User administration Editing Fulltext search Compact permalinks Height profile Custom feature info templates Mapinfo popup Reports (via Jasper) qwc-services also provides the following enterprise relevant functionalities: Docker/Kubernetes or WSGI deployments Multi-tenant setup Custom service integration Multiple authentication backends Explore Quickstart Some public viewers: Demo | Glarus | Solothurn | qgisweb.oslandia.net | Erft Verband Support Community support: Github Commercial Support: Sourcepole and other companies. Improve this web site","title":"Home"},{"location":"#qwc2-qwc-services","text":"QGIS Web Client 2 (QWC2) is a modular next generation responsive web client for QGIS Server, built with ReactJS and OpenLayers. The core concept of QWC2 is to display QGIS Projects which are published by QGIS Server via WMS. There are two ways to run QWC2: As part of the qwc-services ecosystem, includes additional services to which includes additional services to extend the viewer functionality (such as user administration, editing, etc.). This is the recommended approach. As a standalone viewer (static JS/HTML/CSS web application) on top of QGIS Server. QWC2 with qwc-servies on the backend provide a complete Web GIS infrastructure.","title":"QWC2 / QWC Services"},{"location":"#overview-of-functionalities","text":"Without any additional services, the stock QWC2 offers the following main functionalities: Theme switcher (a theme is a published QGIS project) Switchable background layers Layer tree Object information (feature info) Search with configurable providers Measurement tools Redlining (sketching) URL sharing Geolocation PDF printing Raster and DXF export Compare layers Import external layers (WMS, WFS, WMTS, KML, GeoJSON) When run as part of the qwc-services ecosystem, the following additional viewer functionalities are available: User administration Editing Fulltext search Compact permalinks Height profile Custom feature info templates Mapinfo popup Reports (via Jasper) qwc-services also provides the following enterprise relevant functionalities: Docker/Kubernetes or WSGI deployments Multi-tenant setup Custom service integration Multiple authentication backends","title":"Overview of functionalities"},{"location":"#explore","text":"Quickstart Some public viewers: Demo | Glarus | Solothurn | qgisweb.oslandia.net | Erft Verband","title":"Explore"},{"location":"#support","text":"Community support: Github Commercial Support: Sourcepole and other companies. Improve this web site","title":"Support"},{"location":"FAQ/","text":"FAQ","title":"FAQ"},{"location":"FAQ/#faq","text":"","title":"FAQ"},{"location":"QuickStart/","text":"Quick start Running QWC2 as part of qwc-services qwc-services is a collection of loosely coupled micro-services for extending QWC2. The services communicate with each other via HTTP/Rest, and are mostly written in Python. The easiest way to run qwc-services is to use the readily available docker images, using the sample setup at qwc-docker . To be able to run qwc-docker , first install docker and docker compose : Docker: https://docs.docker.com/engine/install/ docker-compose: https://docs.docker.com/compose/install/ Then, follow these steps: Clone the qwc-docker sample setup at qwc-docker and copy the docker-compose and api-gateway configuration templates: git clone https://github.com/qwc-services/qwc-docker.git cd qwc-docker cp docker-compose-example.yml docker-compose.yml cp api-gateway/nginx-example.conf api-gateway/nginx.conf Create a secret key: python3 -c 'import secrets; print(\"JWT_SECRET_KEY=\\\"%s\\\"\" % secrets.token_hex(48))' >.env Change the UID/GID which runs the QWC services to match the user/group which owns the shared volumes on the host by setting SERVICE_UID and SERVICE_GID in qwc-docker/docker-compose.yml . Set permissions for the shared solr data volume: sudo chown 8983:8983 volumes/solr/data Start all containers (will download all images from dockerhub when executed the first time): docker-compose up The map viewer will run on http://localhost:8088/ . The admin GUI will run on http://localhost:8088/qwc_admin (default admin credentials: username admin , password admin , requires password change on first login). Next steps: Configure the themes Customize the viewer Configuring the services Set resource permissions Running QWC2 as a standalone viewer If you don't need the advanced functionalities provided by qwc-services or want to integrate QWC2 in another environment, you can run QWC2 as a standalone viewer. To work with QWC2, you will need a minimal development environment consisting of git , node and yarn . You will also need a running QGIS Server instance which serves your projects. The fastest way to get started is by cloning the demo application: git clone --recursive https://github.com/qgis/qwc2-demo-app.git Next, install all required dependencies: cd qwc2-demo-app yarn install Then, start a local development application: yarn start The development application will run by default on http://localhost:8081 . At this point, you can customize and configure the application according to your needs, as described in detail in the following chapters. The final step is to compile a deployable application bundle for production: yarn run prod You can then deploy the contents of the prod folder to your web server. Next steps: Configure the themes Customize the viewer","title":"Quick start"},{"location":"QuickStart/#quick-start","text":"","title":"Quick start"},{"location":"QuickStart/#running-qwc2-as-part-of-qwc-services","text":"qwc-services is a collection of loosely coupled micro-services for extending QWC2. The services communicate with each other via HTTP/Rest, and are mostly written in Python. The easiest way to run qwc-services is to use the readily available docker images, using the sample setup at qwc-docker . To be able to run qwc-docker , first install docker and docker compose : Docker: https://docs.docker.com/engine/install/ docker-compose: https://docs.docker.com/compose/install/ Then, follow these steps: Clone the qwc-docker sample setup at qwc-docker and copy the docker-compose and api-gateway configuration templates: git clone https://github.com/qwc-services/qwc-docker.git cd qwc-docker cp docker-compose-example.yml docker-compose.yml cp api-gateway/nginx-example.conf api-gateway/nginx.conf Create a secret key: python3 -c 'import secrets; print(\"JWT_SECRET_KEY=\\\"%s\\\"\" % secrets.token_hex(48))' >.env Change the UID/GID which runs the QWC services to match the user/group which owns the shared volumes on the host by setting SERVICE_UID and SERVICE_GID in qwc-docker/docker-compose.yml . Set permissions for the shared solr data volume: sudo chown 8983:8983 volumes/solr/data Start all containers (will download all images from dockerhub when executed the first time): docker-compose up The map viewer will run on http://localhost:8088/ . The admin GUI will run on http://localhost:8088/qwc_admin (default admin credentials: username admin , password admin , requires password change on first login). Next steps: Configure the themes Customize the viewer Configuring the services Set resource permissions","title":"Running QWC2 as part of qwc-services"},{"location":"QuickStart/#running-qwc2-as-a-standalone-viewer","text":"If you don't need the advanced functionalities provided by qwc-services or want to integrate QWC2 in another environment, you can run QWC2 as a standalone viewer. To work with QWC2, you will need a minimal development environment consisting of git , node and yarn . You will also need a running QGIS Server instance which serves your projects. The fastest way to get started is by cloning the demo application: git clone --recursive https://github.com/qgis/qwc2-demo-app.git Next, install all required dependencies: cd qwc2-demo-app yarn install Then, start a local development application: yarn start The development application will run by default on http://localhost:8081 . At this point, you can customize and configure the application according to your needs, as described in detail in the following chapters. The final step is to compile a deployable application bundle for production: yarn run prod You can then deploy the contents of the prod folder to your web server. Next steps: Configure the themes Customize the viewer","title":"Running QWC2 as a standalone viewer"},{"location":"configuration/ResourcesPermissions/","text":"Managing Users, Resources and Permissions qwc-docker has a QWC configuration backend . That backend can be reached by default at http://localhost:8088/qwc_admin . The configuration backend allows to assign users and groups to roles. The roles in their turn can receive permissions on resources. These configuration settings will be stored in the configuration database . Out of the box qwc-docker comes with with a container qwc-postgis that contains the configuration database. Users, groups and roles Roles can be given permissions on resources. That means that if you want to give users or groups permissions on resources, then you have to first create a role, configure the permissions that the roles has on some resources, and then assign the role the users or groups. Resources The following resource types are available: Map : WMS corresponding to a QGIS Project Layer : layer of a map Attribute : attribute of a map layer Print template : print composer template of a QGIS Project Data : Data layer for editing Attribute : attribute of a data layer Data (create) : Data layer for creating features Data (read) : Data layer for reading features Data (update) : Data layer for updating features Data (delete) : Data layer for deleting features Viewer : custom map viewer configuration Viewer task : permittable viewer tasks FeatureInfo service : Feature info service FeatureInfo layer : Feature info layer The resource name corresponds to the technical name of its resource (e.g. WMS layer name). Most notably, the name of a map resource corresponds to the relative path to the project below qgs-resources without .qgs extension (so i.e. the resource name for qgs-resources/subfolder/project.qgs will be subfolder/project ). Note: If your QGIS project is configured to return the field aliases rather than the field names in GetFeatureInfo , the resource name for layer attribute resources corresponds to the alias of the field. Available map , layer , attribute and print_template resources are determined from WMS GetProjectSettings and the QGIS projects. data and their attribute resources define a data layer for the Data service . For more detailed CRUD permissions data_create , data_read , data_update and data_delete can be used instead of data ( data and write=False is equivalent to data_read ; data and write=True is equivalent to all CRUD resources combined). The viewer resource defines a custom viewer configuration for the map viewer (see Custom viewer configurations ). The viewer_task resource defines viewer functionalities (e.g. printing or raster export) that can be restricted or permitted. Their name (e.g. RasterExport ) corresponds to the key in menuItems and toolbarItems in the QWC2 config.json . Restricted viewer task items are then removed from the menu and toolbar in the map viewer. Viewer tasks not explicitly added as resources are kept unchanged from the config.json . Note : The resource types, i.e. for custom QWC2 plugins, can be extended by inserting new types into the qwc_config.resource_types table. These can be queried, e.g. in a custom service, by using PermissionClient::resource_permissions() or PermissionClient::resource_restrictions() from QWC Services Core . Permissions Permissions are based on roles. Roles can be assigned to groups or users, and users can be members of groups. A special role is \"public\". The \"public\" role applies always, no matter whether a user is signed in or is not signed in. Roles can be assigned permission for resources. The write flag is only used for data resources and determines whether a data layer is read-only. Based on the user's identity (user name and/or group name), all corresponding roles and their permissions and restrictions are collected. The service configurations are then modified according to these permissions and restrictions. By using the permissions_default_allow configuration setting in tenantConfig.json , some resources can be set to be permitted or restricted by default if no permissions are set (default: false ). Among affected resources are Map , Layer , Print template , Viewer task , FeatureInfo service , FeatureInfo layer . E.g.: permissions_default_allow=true : all maps and layers are permitted by default permissions_default_allow=false : maps and layers are only available if their resources and permissions are explicitly configured Restricted themes The display behaviour of restricted themes can be configured in the mapViewer service configuration in tenantConfig.json as follows: { \"name\": \"mapViewer\", \"config\": { \"show_restricted_themes\": false, \"show_restricted_themes_whitelist\": [], \"redirect_restricted_themes_to_auth\": false, \"internal_permalink_service_url\": \"http://qwc-permalink-service:9090\" } } show_restricted_themes : Whether to show placeholder items for restricted themes. Default: false . show_restricted_themes_whitelist : Whitelist of restricted theme names to display as placeholders. If empty, all restricted themes are shown. Only used if show_restricted_themes enabled. Default: [] . redirect_restricted_themes_to_auth : Whether to redirect to login on auth service if requesting a restricted theme in URL params, if not currently signed in. Default: false . internal_permalink_service_url : Internal permalink service URL for getting the theme from a resolved permalink for redirecting to login (default: http://qwc-permalink-service:9090 ). This is used only if redirect_restricted_themes_to_auth is enabled and permalink_service_url is set. Permissions file The QWC Config Generator generates a JSON file for all permissions from the QWC ConfigDB. See READMEs of QWC services for service specific contents in permissions.json . Group registration Using the optional Registration GUI allows users to request membership or unsubscribe from registrable groups. These requests can then be accepted or rejected in the Admin GUI . Workflow: Admin GUI admin user creates new groups with assigned roles and permissions on resources admin user configures registrable groups Registration GUI user select desired groups from registrable groups and submits application form admin users are notified of new registration requests Admin GUI admin user selects entry from list of pending registration requests admin user accepts or rejects registration requests for a user user is added to or removed from accepted groups user is notified of registration request updates Map Viewer user permissions are updated for new groups","title":"Resources and permissions"},{"location":"configuration/ResourcesPermissions/#managing-users-resources-and-permissions","text":"qwc-docker has a QWC configuration backend . That backend can be reached by default at http://localhost:8088/qwc_admin . The configuration backend allows to assign users and groups to roles. The roles in their turn can receive permissions on resources. These configuration settings will be stored in the configuration database . Out of the box qwc-docker comes with with a container qwc-postgis that contains the configuration database.","title":"Managing Users, Resources and Permissions"},{"location":"configuration/ResourcesPermissions/#users-groups-and-roles","text":"Roles can be given permissions on resources. That means that if you want to give users or groups permissions on resources, then you have to first create a role, configure the permissions that the roles has on some resources, and then assign the role the users or groups.","title":"Users, groups and roles"},{"location":"configuration/ResourcesPermissions/#resources","text":"The following resource types are available: Map : WMS corresponding to a QGIS Project Layer : layer of a map Attribute : attribute of a map layer Print template : print composer template of a QGIS Project Data : Data layer for editing Attribute : attribute of a data layer Data (create) : Data layer for creating features Data (read) : Data layer for reading features Data (update) : Data layer for updating features Data (delete) : Data layer for deleting features Viewer : custom map viewer configuration Viewer task : permittable viewer tasks FeatureInfo service : Feature info service FeatureInfo layer : Feature info layer The resource name corresponds to the technical name of its resource (e.g. WMS layer name). Most notably, the name of a map resource corresponds to the relative path to the project below qgs-resources without .qgs extension (so i.e. the resource name for qgs-resources/subfolder/project.qgs will be subfolder/project ). Note: If your QGIS project is configured to return the field aliases rather than the field names in GetFeatureInfo , the resource name for layer attribute resources corresponds to the alias of the field. Available map , layer , attribute and print_template resources are determined from WMS GetProjectSettings and the QGIS projects. data and their attribute resources define a data layer for the Data service . For more detailed CRUD permissions data_create , data_read , data_update and data_delete can be used instead of data ( data and write=False is equivalent to data_read ; data and write=True is equivalent to all CRUD resources combined). The viewer resource defines a custom viewer configuration for the map viewer (see Custom viewer configurations ). The viewer_task resource defines viewer functionalities (e.g. printing or raster export) that can be restricted or permitted. Their name (e.g. RasterExport ) corresponds to the key in menuItems and toolbarItems in the QWC2 config.json . Restricted viewer task items are then removed from the menu and toolbar in the map viewer. Viewer tasks not explicitly added as resources are kept unchanged from the config.json . Note : The resource types, i.e. for custom QWC2 plugins, can be extended by inserting new types into the qwc_config.resource_types table. These can be queried, e.g. in a custom service, by using PermissionClient::resource_permissions() or PermissionClient::resource_restrictions() from QWC Services Core .","title":"Resources"},{"location":"configuration/ResourcesPermissions/#permissions","text":"Permissions are based on roles. Roles can be assigned to groups or users, and users can be members of groups. A special role is \"public\". The \"public\" role applies always, no matter whether a user is signed in or is not signed in. Roles can be assigned permission for resources. The write flag is only used for data resources and determines whether a data layer is read-only. Based on the user's identity (user name and/or group name), all corresponding roles and their permissions and restrictions are collected. The service configurations are then modified according to these permissions and restrictions. By using the permissions_default_allow configuration setting in tenantConfig.json , some resources can be set to be permitted or restricted by default if no permissions are set (default: false ). Among affected resources are Map , Layer , Print template , Viewer task , FeatureInfo service , FeatureInfo layer . E.g.: permissions_default_allow=true : all maps and layers are permitted by default permissions_default_allow=false : maps and layers are only available if their resources and permissions are explicitly configured","title":"Permissions"},{"location":"configuration/ResourcesPermissions/#restricted-themes","text":"The display behaviour of restricted themes can be configured in the mapViewer service configuration in tenantConfig.json as follows: { \"name\": \"mapViewer\", \"config\": { \"show_restricted_themes\": false, \"show_restricted_themes_whitelist\": [], \"redirect_restricted_themes_to_auth\": false, \"internal_permalink_service_url\": \"http://qwc-permalink-service:9090\" } } show_restricted_themes : Whether to show placeholder items for restricted themes. Default: false . show_restricted_themes_whitelist : Whitelist of restricted theme names to display as placeholders. If empty, all restricted themes are shown. Only used if show_restricted_themes enabled. Default: [] . redirect_restricted_themes_to_auth : Whether to redirect to login on auth service if requesting a restricted theme in URL params, if not currently signed in. Default: false . internal_permalink_service_url : Internal permalink service URL for getting the theme from a resolved permalink for redirecting to login (default: http://qwc-permalink-service:9090 ). This is used only if redirect_restricted_themes_to_auth is enabled and permalink_service_url is set.","title":"Restricted themes"},{"location":"configuration/ResourcesPermissions/#permissions-file","text":"The QWC Config Generator generates a JSON file for all permissions from the QWC ConfigDB. See READMEs of QWC services for service specific contents in permissions.json .","title":"Permissions file"},{"location":"configuration/ResourcesPermissions/#group-registration","text":"Using the optional Registration GUI allows users to request membership or unsubscribe from registrable groups. These requests can then be accepted or rejected in the Admin GUI . Workflow: Admin GUI admin user creates new groups with assigned roles and permissions on resources admin user configures registrable groups Registration GUI user select desired groups from registrable groups and submits application form admin users are notified of new registration requests Admin GUI admin user selects entry from list of pending registration requests admin user accepts or rejects registration requests for a user user is added to or removed from accepted groups user is notified of registration request updates Map Viewer user permissions are updated for new groups","title":"Group registration"},{"location":"configuration/ServiceConfiguration/","text":"QWC Services configuration The architecture of qwc-services is as follows: API-Gateway: API Gateway, forwards requests to individual services http://localhost:8088 Auth-Service: Authentication service with local user database (default users: admin:admin, demo:demo) http://localhost:8088/auth/login Map viewer: QWC2 map viewer http://localhost:8088 OGC Service: Proxy for WMS/WFS requests filtered by permissions, calls QGIS Server http://localhost:8088/ows/api Admin GUI: Admin GUI http://localhost:8088/qwc_admin/ qwc-docker ships a pre-configured the qwc-services ecosystem as an easy to use application. Service overview Following is an overview of existing qwc-services : Applications : QWC2 Map Viewer : The map viewer application QWC Admin GUI : Configuration backend for managing users and permissions Registration GUI : GUI for registration of new users REST services : DB auth service : Authentication service with local user database LDAP auth service : LDAP Authentication service Data service : Data edit service, required for QWC2 editing functionality Document service : Service for generating Jasper reports Elevation service : Service for providing elevation data, required for QWC2 elevation profile Feature info service : Service for providing enhanced GetFeatureInfo responses to QWC2 Fulltext search service : Fulltext search service for the QWC2 search functionality Legend service : Service for providing enhanced legend graphics to QWC2 Mapinfo service : Service for providing additional information to the QWC2 right-click map context popup OGC service : Proxy for WMS/WFS requests filtered by permissions, calls QGIS Server Permalink service : Service for storing compat permalinks and bookmarks generated by QWC2 Print service : Service for enhancing the QWC2 GetPrint requests Configuration database : DB schema and migrations Demo database Configuration generator : Configuration generator qwc-docker layout The layout of the qwc-docker tree is as follows: Path Description \u251c\u2500 api-gateway/nginx.conf API gateway configuration. \u251c\u2500 volumes/ Contains folders which are mounted into the various containers. \u2502 \u251c\u2500 attachments Storage of files uploaded through the QWC2 editing functionality. \u2502 \u251c\u2500 config/