diff --git a/Makefile b/Makefile index 54cfd5a5..7495a71d 100644 --- a/Makefile +++ b/Makefile @@ -3,18 +3,18 @@ all: fetch: no=1; \ for repo in qwc-map-viewer qwc-ogc-service qwc-feature-info-service qwc-fulltext-search-service qwc-legend-service qwc-permalink-service qwc-print-service qwc-mapinfo-service qwc-data-service qwc-document-service qwc-elevation-service qwc-admin-gui qwc-registration-gui qwc-config-generator; do \ - echo "+++\ntitle = \"$$repo\"\nmenuTitle = \"$$repo\"\nweight = $$no\n+++" >content/services/$$repo.md; \ - curl -s -L https://github.com/qwc-services/$$repo/raw/master/README.md | sed '/^\[/d' >>content/services/$$repo.md; \ + echo "+++\nmenuTitle = \"$$repo\"\nweight = $$no\nchapter = false\n+++" >content/installation/services/$$repo.md; \ + curl -s -L https://github.com/qwc-services/$$repo/raw/master/README.md | sed '/^\[/d' >>content/installation/services/$$repo.md; \ no=$$((no+1)); \ done no=1; \ for repo in qwc-db-auth qwc-ldap-auth; do \ - echo "+++\ntitle = \"$$repo\"\nmenuTitle = \"$$repo\"\nweight = $$no\n+++" >content/authentication/$$repo.md; \ - curl -s -L https://github.com/qwc-services/$$repo/raw/master/README.md | sed '/^\[/d' >>content/authentication/$$repo.md; \ + echo "+++\nmenuTitle = \"$$repo\"\nweight = $$no\nchapter = false\n+++" >content/installation/authentication/$$repo.md; \ + curl -s -L https://github.com/qwc-services/$$repo/raw/master/README.md | sed '/^\[/d' >>content/installation/authentication/$$repo.md; \ no=$$((no+1)); \ done - echo "+++\ntitle = \"QGIS Web Client 2\"\nmenuTitle = \"Viewer\"\nweight = 3\n+++\n" >content/viewer/_index.md; \ - curl -s -L https://github.com/qgis/qwc2-demo-app/raw/master/doc/QWC2_Documentation.md >>content/viewer/_index.md; + echo "+++\nmenuTitle = \"Viewer\"\nweight = 3\nchapter = false\n+++\n" >content/installation/viewer/_index.md; \ + curl -s -L https://github.com/qgis/qwc2-demo-app/raw/master/doc/QWC2_Documentation.md >>content/installation/viewer/_index.md; schemas: # Convert JSON schemas to Markdown @@ -22,8 +22,8 @@ schemas: no=1; \ for repo in qwc-map-viewer qwc-ogc-service qwc-feature-info-service qwc-fulltext-search-service qwc-legend-service qwc-permalink-service qwc-print-service qwc-mapinfo-service qwc-data-service qwc-document-service qwc-elevation-service qwc-ext-service qwc-admin-gui qwc-registration-gui qwc-config-generator; do \ curl -s -o /tmp/schema.json -L https://github.com/qwc-services/$$repo/raw/master/schemas/$$repo.json; \ - echo "+++\ntitle = \"$$repo\"\nweight = $$no\n+++" >content/configuration/$$repo.md; \ + echo "+++\ntitle = \"$$repo\"\nweight = $$no\n+++" >content/installation/configuration/$$repo.md; \ .venv/bin/generate-schema-doc --config template_name=md /tmp/schema.json /tmp/schema.md; \ - cat /tmp/schema.md >>content/configuration/$$repo.md; \ + cat /tmp/schema.md >>content/installation/configuration/$$repo.md; \ no=$$((no+1)); \ done diff --git a/content/setup/_index.md b/content/setup/_index.md new file mode 100644 index 00000000..c9eacda2 --- /dev/null +++ b/content/setup/_index.md @@ -0,0 +1,10 @@ +--- +title: "Setup" +date: 2022-11-03T14:15:36+01:00 +chapter: true +weight: 2 +--- + +# Setup + +This section aims to explain how to install/deploy all of *QWC services*. \ No newline at end of file diff --git a/content/authentication/_index.md b/content/setup/authentication/_index.md similarity index 90% rename from content/authentication/_index.md rename to content/setup/authentication/_index.md index ee9b1294..59c72490 100644 --- a/content/authentication/_index.md +++ b/content/setup/authentication/_index.md @@ -1,7 +1,7 @@ +++ title = "Authentication" date = 2021-09-17T16:40:01+02:00 -weight = 6 +weight = 5 chapter = true +++ diff --git a/content/authentication/qwc-db-auth.md b/content/setup/authentication/qwc-db-auth.md similarity index 79% rename from content/authentication/qwc-db-auth.md rename to content/setup/authentication/qwc-db-auth.md index 3439f57e..03d66e10 100644 --- a/content/authentication/qwc-db-auth.md +++ b/content/setup/authentication/qwc-db-auth.md @@ -1,9 +1,12 @@ +++ -title = "DB Authentication Service" menuTitle = "qwc-db-auth" weight = 1 +chapter = false +++ +Authentication with User DB +=========================== + Authentication service with local user database. @@ -50,11 +53,33 @@ A minimum password length of `8` with no other constraints is set by default. Op `password_min_length` and `password_max_length` can be set independently. `password_constraints` is a list of regular expression of which at least `password_min_constraints` have to match for the password to be valid, otherwise the `password_constraints_message` is shown. Note that the regular expression have to be JSON escaped and allow only patterns supported by Python's `re` module. +If the `qwc_config.password_histories` table is present, additional optional password constraints may be set: +```json +"config": { + "password_expiry": 365, + "password_expiry_notice": 10, + "password_update_interval": 600, + "password_allow_reuse": false +} +``` + +* `password_expiry` (default: `-1`): Number of days until a password expires, or `-1` to disable. Forces a password change once expired. +* `password_expiry_notice` (default: `-1`): Show an expiry notice within this number of days before a password expires, or `-1` to disable +* `password_update_interval` (default: `-1`): Min number of seconds before a password may be changed again, or `-1` to disable +* `password_allow_reuse` (default: `true`): Set whether a user may reuse previous passwords or not + Besides the form based DB login, an (insecure) plain POST login is supported. This method can be activated by setting `POST_PARAM_LOGIN=True`. User and password are passed as POST parameters `username` and `password`. Usage example: `curl -d 'username=demo&password=demo' http://localhost:5017/login`. +Additional user info fields from `qwc_config.user_infos` may be added to the JWT identity by setting `user_info_fields`: +```json +"config": { + "user_info_fields": ["surname", "first_name"] +} +``` + * `MAIL_SERVER`: default ‘localhost’ * `MAIL_PORT`: default 25 * `MAIL_USE_TLS`: default False diff --git a/content/authentication/qwc-ldap-auth.md b/content/setup/authentication/qwc-ldap-auth.md similarity index 97% rename from content/authentication/qwc-ldap-auth.md rename to content/setup/authentication/qwc-ldap-auth.md index 79e2f436..047c560f 100644 --- a/content/authentication/qwc-ldap-auth.md +++ b/content/setup/authentication/qwc-ldap-auth.md @@ -1,10 +1,11 @@ +++ -title = "LDAP Authentication Service" menuTitle = "qwc-ldap-auth" weight = 2 +chapter = false +++ Authentication with LDAP/Active Directory +========================================= Configuration ------------- diff --git a/content/configuration/_index.md b/content/setup/configuration/_index.md similarity index 99% rename from content/configuration/_index.md rename to content/setup/configuration/_index.md index 5618a6a2..9c871d62 100644 --- a/content/configuration/_index.md +++ b/content/setup/configuration/_index.md @@ -1,7 +1,7 @@ +++ title = "Configuration" date = 2021-09-17T15:11:34+02:00 -weight = 3 +weight = 2 chapter = false +++ diff --git a/content/quick-start/_index.md b/content/setup/quick-start/_index.md similarity index 99% rename from content/quick-start/_index.md rename to content/setup/quick-start/_index.md index 32bba38f..b09cee92 100644 --- a/content/quick-start/_index.md +++ b/content/setup/quick-start/_index.md @@ -1,7 +1,7 @@ +++ title = "Quick Start" date = 2021-09-17T15:10:55+02:00 -weight = 2 +weight = 1 chapter = false +++ diff --git a/content/services/_index.md b/content/setup/services/_index.md similarity index 100% rename from content/services/_index.md rename to content/setup/services/_index.md diff --git a/content/services/qwc-admin-gui.md b/content/setup/services/qwc-admin-gui.md similarity index 78% rename from content/services/qwc-admin-gui.md rename to content/setup/services/qwc-admin-gui.md index 3a9d6fc7..97e89637 100644 --- a/content/services/qwc-admin-gui.md +++ b/content/setup/services/qwc-admin-gui.md @@ -1,9 +1,12 @@ +++ -title = "QWC Admin GUI" menuTitle = "qwc-admin-gui" -weight = 13 +weight = 12 +chapter = false +++ +QWC Admin GUI +============= + GUI for administration of QWC Services. * manage users, groups and roles @@ -120,6 +123,43 @@ Translation strings are stored in a JSON file for each locale in `translations/< Set the `DEFAULT_LOCALE` environment variable to choose the locale for the user notification mails (default: `en`). +### Solr search index update + +If using a Solr search service, the Solr search index of a tenant may be updated via a button on the main page. This can be activated by adding the following configuration options to the Admin GUI service config: +```json +{ + "config": { + "solr_service_url": "http://qwc-solr:8983/solr/gdi/", + "solr_tenant_dih": "dih_geodata", + "solr_tenant_dih_config_file": "/solr/config-in/dih_geodata_config.xml", + "solr_config_path": "/solr/config-out", + "solr_update_check_wait": 5, + "solr_update_check_max_retries": 10 + } +} +``` + +* `solr_service_url`: Solr Service base URL for collection +* `solr_tenant_dih`: Solr DataImportHandler for the tenant +* `solr_tenant_dih_config_file` (optional): Path to source DataImportHandler config file for the tenant +* `solr_config_path` (optional): Path to Solr configs (**Note:** requires write permissions for DataImportHandler config files) +* `solr_update_check_wait` (optional): Wait time in seconds for checks during Solr index update (default: `5`s) +* `solr_update_check_max_retries` (optional): Max number of retries for checks during Solr index update (default: `10`) + +If both `solr_tenant_dih_config_file` and `solr_config_path` are set, the tenant config file is first copied to the Solr configs dir before updating the Solr search index. + +Example volumes for `qwc-docker` environment and above service config: +```yaml +services: + qwc-admin-gui: + # ... + volumes: + # ... + # Solr configs + - ./volumes/solr/configsets/gdi/conf:/solr/config-in:ro + - ./volumes/solr/data/gdi/conf:/solr/config-out +``` + ### Plugins The admin gui is extendable through plugins, which reside in the `plugins` folder. To enable them, list them in `plugins` in the admin gui configuration. See the JSON schema for details, and for configuration parameters which may be required by plugins shipped by default with `qwc-admin-gui`. diff --git a/content/services/qwc-config-generator.md b/content/setup/services/qwc-config-generator.md similarity index 67% rename from content/services/qwc-config-generator.md rename to content/setup/services/qwc-config-generator.md index 4284745a..460620e4 100644 --- a/content/services/qwc-config-generator.md +++ b/content/setup/services/qwc-config-generator.md @@ -1,10 +1,13 @@ +++ -title = "QWC Config Generator" menuTitle = "qwc-config-generator" -weight = 15 +weight = 14 +chapter = false +++ -Generate JSON files for service configs and permissions from WMS GetCapabilities, QGS projects and QWC ConfigDB. +QWC ConfigGenerator +==================== + +Generates JSON files for service configs and permissions from WMS GetCapabilities, QGS projects and QWC ConfigDB. Setup @@ -29,7 +32,8 @@ Example `tenantConfig.json`: "qgis_projects_scan_base_dir": "/data/scan", "qgis_projects_gen_base_dir": "/data/gen", "permissions_default_allow": true, - "validate_schema": true + "validate_schema": true, + "autogen_keyvaltable_datasets": false }, "themesConfig": { "defaultScales": [100000000, 50000000, 25000000, 10000000, 4000000, 2000000, 1000000, 400000, 200000, 80000, 40000, 20000, 10000, 8000, 6000, 4000, 2000, 1000, 500, 250, 100], @@ -173,30 +177,24 @@ Example `tenantConfig.json`: For a full example see [tenantConfig-example.json](tenantConfig-example.json) ([JSON schema](schemas/qwc-config-generator.json)). -*NOTE:* the QWC2 themes config is defined under `themesConfig` in the ConfigGenerator config and not in a separate file. +*NOTE:* QWC2 themes are defined under `themesConfig` in the ConfigGenerator configuration and not in a separate file. QGIS projects can be automatically detected when `qgis_projects_scan_base_dir` is defined. -For adding these projects, the following settings need to be defined in `themesConfig`. +In order to have projects automatically added, the following settings need to be defined in `themesConfig`. - `defaultBackgroundLayers` - `defaultSearchProviders` - `defaultMapCrs` -Additionally the config generator can also autodetect thumbnails when adding projects that meet the following criteria: - -- `qwc2_base_dir` is defined in the ConfigGenerator config -- the thumbnail of the project is located in the QWC2 thumbnail directory (Example: `/qwc/assets/img/mapthumbs`) -- the thumbnail image has the same filename as the QGIS project - -The config generator also has the ability to split a layer, that has been [classified](https://docs.qgis.org/3.16/en/docs/training_manual/vector_classification/classification.html) with QGIS, into multiple layers and move them into a new group (The group name will be the original layer name). The following steps need to be done, to activate this functionality: +The ConfigGenerator can also autodetect thumbnails when adding projects. The projects have to meet the following criteria: -1. Set ConfigGenerator config: `"split_categorized_layers": true` +- `qwc2_base_dir` is defined in the ConfigGenerator configuration +- the thumbnail of the project has to be located in the QWC2 thumbnail directory (Example: `/qwc/assets/img/mapthumbs`) +- the thumbnail image needs to have the same filename as the QGIS project -2. Define the environment variable `QGIS_APPLICATION_PREFIX_PATH` (default: `/usr`). The prefix path is the location where QGIS is installed on your system. This is needed by the split function, because it uses the `qgis.core` library. +*NOTE:* the Search service configuration takes its resources directly from the ConfigGenerator configuration. Its Permissions are collected from the ConfigDB (`solr_facet` resources), unless they are defined in the ConfigGenerator configuration. -*NOTE:* The Search service config takes its resources directly from the ConfigGenerator config. Its Permissions are collected from the ConfigDB (`solr_facet` resources), unless they are defined in the ConfigGenerator config. - -*NOTE:* the FeatureInfo service config may take additional WMS service resources and permissions directly from the ConfigGenerator config, e.g. for external info layers. Its Permissions are collected from the ConfigDB (`feature_info_service`, `feature_info_layer` resources), unless they are defined in the ConfigGenerator config. Example: +*NOTE:* the FeatureInfo service configuration may take additional WMS service resources and permissions directly from the ConfigGenerator configuration, e.g. for external info layers. Its Permissions are collected from the ConfigDB (`feature_info_service`, `feature_info_layer` resources), unless they are defined in the ConfigGenerator configuration. Example: ```json { @@ -258,9 +256,27 @@ The config generator also has the ability to split a layer, that has been [class ``` +### Split categorized layers + +The ConfigGenerator has also the ability to split a layer, that has been [classified](https://docs.qgis.org/3.16/en/docs/training_manual/vector_classification/classification.html) with QGIS, into multiple layers and move them into a new group (the group name will be the original layer name). The following steps need to be done, to activate this functionality: + +1. Place the projects whose layers you want to split below `//qgis_projects`. + +2. Ensure `qgis_projects_gen_base_dir` is set in the ConfigGenerator configuration, see the [schema definition](https://github.com/qwc-services/qwc-config-generator/blob/master/schemas/qwc-config-generator.json) for more details. + +3. In the ConfigGenerator configuration set: `"split_categorized_layers": true` + +4. If necessary, define the environment variable `QGIS_APPLICATION_PREFIX_PATH` (default: `/usr`). The prefix path is the location where QGIS is installed on your system (the split function needs this, because it uses the `qgis.core` library) + +5. For all layers that you want to split, create the [variable](https://docs.qgis.org/3.22/en/docs/user_manual/working_with_vector/vector_properties.html#variables-properties) 'convert_categorized_layer' and set it to 'true'. + +6. The ConfigGenerator will process the projects and write the modified projects to qgis_projects_gen_base_dir`. Hence, if for instance qgis_projects_base_dir=/data` and `qgis_projects_gen_base_dir=/data/gen`, the resource name for map `mymap` will be `gen/mymap`. + +*NOTE:* If you are using the qwc-config-generator Docker images, make sure you are using `qwc-config-generator:v` and not `qwc-config-generator:v-noqgis`. + ### Schema validation -By default, the config-generator will validate the service configurations in `tenantConfig.json` against the schema definition of the service. This requires network access to `raw.githubusercontent.com`. You can disable the schema validation by setting `"validate_schema": false` in config-generator `config` block in `tenantConfig.json`. +By default, the ConfigGenerator will validate the service configurations in `tenantConfig.json` against the schema definition of the service. The JSON Schemas are loaded from local files in `JSON_SCHEMAS_PATH`, or else downloaded from https://github.com/qwc-services/ if no schema files are present. You can disable the schema validation by setting `"validate_schema": false` in the ConfigGenerator's `config` block in `tenantConfig.json`. ### Permissions @@ -301,10 +317,10 @@ Generate permissions file: ### Service -Set the `INPUT_CONFIG_PATH` environment variable to the base dir for reading generator config files (default: `config-in/`). -Set the `OUTPUT_CONFIG_PATH` environment variable to the base dir for writing service configs and permissions (default: `/tmp/`). +Set the `INPUT_CONFIG_PATH` environment variable to the base directory where for the configuration files are that should be read by the ConfigGenerator (default: `config-in/`). +Set the `OUTPUT_CONFIG_PATH` environment variable to the base directory where the ConfigGenerator should output service configurations and permissions (default: `/tmp/`). -*NOTE:* Requires write permissions for config-generator docker user (`www-data`) in `OUTPUT_CONFIG_PATH` for writing service configs and permissions. +*NOTE:* the ConfigGenerator's docker user (`www-data`) needs to have write permissions to the directory defined in `OUTPUT_CONFIG_PATH`! Base URL: @@ -314,6 +330,15 @@ Generate both service configs and permissions for `default` tenant: curl -X POST "http://localhost:5010/generate_configs?tenant=default" +### Update JSON schemas + +You can change the directory from where the ConfigGenerator reads its schemas via the `JSON_SCHEMAS_PATH` environment variable (default `/tmp/`). +You can change the versions of the schemas that the ConfigGenerator uses for verification inside [schema-versions.json](schemas/schema-versions.json) (default: current `master`). + +Download JSON schemas: + + python download_json_schemas.py + Development ----------- diff --git a/content/services/qwc-data-service.md b/content/setup/services/qwc-data-service.md similarity index 84% rename from content/services/qwc-data-service.md rename to content/setup/services/qwc-data-service.md index 8ddbd667..8532a8eb 100644 --- a/content/services/qwc-data-service.md +++ b/content/setup/services/qwc-data-service.md @@ -1,9 +1,12 @@ +++ -title = "QWC Data Service" menuTitle = "qwc-data-service" weight = 9 +chapter = false +++ +QWC Data Service +================ + Edit spatial and unlocated features of datasets via GeoJSON. **Note:** requires a PostGIS database for reading and writing features @@ -245,13 +248,18 @@ Edit forms: * Create the designer form in Qt-Designer, using the dataset field names as edit widget names. - *Note*: In general, for tables with an auto-incrementing primary key field, you'll want to set the attribute form widget type to "Hidden" in the QGIS layer properties. This way, the data-service won't block the commit if the feature is comitted with an empty PK field value. +- Starting with qwc-map-viewer v2022.05.17, localized translation forms are supported. To this end, place a Qt Translation file called `_.ts` next to the designer form `.ui`, where `lang` is a language or language/country code, i.e. `en` or `en-US`. There is a [`translateui.sh`](https://github.com/qgis/qwc2/tree/master/scripts/translateui.sh) script to help generate the translation files. Example: + + ./translateui.sh <...>/qwc2/assets/forms/form.ui de it fr + + File uploads: - For Autogenerated and Drag and Drop designer forms, set the widget type to Attachment. You can set the file type filter in the widget configuration under `Display button to open file dialog -> Filter`. - For manually created Qt Designed Ui forms, use a `QLineEdit` widget named `__upload`, and optionally as the text value of the `QLineEdit` set a comma separated list of suggested file extensions. - *Note*: Make sure the client uses the EditingInterface.js shipped with [QWC2 submodule f053fdc or newer](https://github.com/qgis/qwc2/commit/f053fdceba4a2d8112fb516c793702b9fd118609) to support file uploads. - You can set the allowed attachment extensions and maximum file sizes globally by setting `allowed_attachment_extensions` and `max_attachment_file_size` in the data service configuration. -- You can also set the allowed attachment extensions and maximum file sizes per dataset by setting `max_attachment_file_size_per_dataset` and `allowed_extensions_per_dataset` in the dataset service configuration. +- You can also set the allowed attachment extensions and maximum file sizes per dataset by setting `max_attachment_file_size_per_dataset` and `allowed_extensions_per_dataset` in the dataset service configuration. If you set the per dataset values, the global settings will be disregarded (i.e. if a attachment satisfies the per dataset constraint it will be considered valid, even if it violates the global constraint). Logging mutations: @@ -265,6 +273,7 @@ Note: for these fields to be written, ensure the qgis project is also up-to-date - For autogenerated and Drag and Drop designer forms, configure the 1-N relation in the QGIS project properties. - In a manually created Qt-Designer Ui form, create a widget of type `QWidget`, `QGroupBox` or `QFrame` named according to the pattern `nrel____`, where `` is the name of the relation table and `` the name of the foreign key field in the relation table. +- In a manually created Qt-Designer Ui form, you can also specify a sort column for the 1:N relation in the form `nrel______`. If a sort-column is specified, QWC2 will display sort arrows for each entry in the relation widget. - Inside this widget, add the edit widgets for the values of the relation table. Name the widgets `__`. These edit widgets will be replicated for each relation record. - *Note:* The relation table needs to be added as a (geometryless) table to the QGIS Project. You also need to set appropriate permissions for the relation table dataset in the QWC admin backend. @@ -272,7 +281,16 @@ Key-value relations: - For Drag and Drop designer forms, use widgets of type Value Relation. In the generated designer form, the naming convention indicated below is used. - In a manually created Qt-Designer Ui form, you can use key-value relations for combo box entries by naming the `QComboBox` widget according to the following pattern: `kvrel________`. `` refers to a table containing a field called `` for the value of the entry and a field `` for the label of the entry. For key-value relations inside a 1:N relation, use `kvrel__________`. `` -- *Note:* In any case, the relation table needs to be added as a (geometryless) table to the QGIS Project. You also need to set appropriate permissions for the relation table dataset in the QWC admin backend. +- *Note:* In any case, the relation table needs to be added as a (geometryless) table to the QGIS Project. You also need to set appropriate permissions for the relation table dataset in the QWC admin backend. Alternatively, you can set `"autogen_keyvaltable_datasets": true` in the config generator configuration, to automatically generate resources and read-only permissions as required. + +Special form widgets: + +- In manually created Qt-Designer Ui forms, there are a number of special widgets you can define: + + * *Images*: To display attribute values which contain an image URL as an inline image, use a `QLabel` named `img__`. + * *Linked features*: To display a button to choose a linked feature and edit it's attributes in a nested edit form, create a `QPushButton` named `featurelink____` (simple join) or `featurelink______` in a 1:N relation. In a 1:N relation, `linkdataset` can be equal to `reltable` to edit the relation record itself in the nested form. `fieldname` will contain the `id` of the linked feature. + * *External fields*: Some times it is useful to display information from an external source in the edit form. This can be accomplished by creating a `QWidget` with name `ext__` and using a form preprocessor hook (see `registerFormPreprocessor` in [`QtDesignerForm.jsx`](https://github.com/qgis/qwc2/blob/master/components/QtDesignerForm.jsx) to populate the field by assigning a React fragment to `formData.externalFields.`. + * *Buttons*: To add a button with a custom action, add a `QPushButton` with name `btn__`, and use a form preprocessor hook to set the custom function to `formData.buttons.buttonname.onClick`. Data service configuration: diff --git a/content/services/qwc-document-service.md b/content/setup/services/qwc-document-service.md similarity index 98% rename from content/services/qwc-document-service.md rename to content/setup/services/qwc-document-service.md index c0622fd8..f8f6d09d 100644 --- a/content/services/qwc-document-service.md +++ b/content/setup/services/qwc-document-service.md @@ -1,9 +1,11 @@ +++ -title = "Document service" menuTitle = "qwc-document-service" weight = 10 +chapter = false +++ +Document service +================ The document service delivers reports from the Jasper reporting service with permission control. diff --git a/content/services/qwc-elevation-service.md b/content/setup/services/qwc-elevation-service.md similarity index 97% rename from content/services/qwc-elevation-service.md rename to content/setup/services/qwc-elevation-service.md index 835abafe..a28e8456 100644 --- a/content/services/qwc-elevation-service.md +++ b/content/setup/services/qwc-elevation-service.md @@ -1,9 +1,11 @@ +++ -title = "QWC Elevation Service" menuTitle = "qwc-elevation-service" weight = 11 +chapter = false +++ +QWC Elevation Service +===================== Returns elevations. diff --git a/content/services/qwc-feature-info-service.md b/content/setup/services/qwc-feature-info-service.md similarity index 99% rename from content/services/qwc-feature-info-service.md rename to content/setup/services/qwc-feature-info-service.md index aad0cacc..b4ca4e79 100644 --- a/content/services/qwc-feature-info-service.md +++ b/content/setup/services/qwc-feature-info-service.md @@ -1,9 +1,11 @@ +++ -title = "QWC FeatureInfo Service" menuTitle = "qwc-feature-info-service" weight = 3 +chapter = false +++ +QWC FeatureInfo Service +======================= Query layers at a geographic position using an API based on WMS GetFeatureInfo. diff --git a/content/services/qwc-fulltext-search-service.md b/content/setup/services/qwc-fulltext-search-service.md similarity index 94% rename from content/services/qwc-fulltext-search-service.md rename to content/setup/services/qwc-fulltext-search-service.md index db055db6..8541ffff 100644 --- a/content/services/qwc-fulltext-search-service.md +++ b/content/setup/services/qwc-fulltext-search-service.md @@ -1,9 +1,11 @@ +++ -title = "QWC Fulltext Search Service" menuTitle = "qwc-fulltext-search-service" weight = 4 +chapter = false +++ +QWC Fulltext Search Service +=========================== Faceted fulltext search and geometry retrieval for search results. @@ -172,6 +174,7 @@ Search API: Examples: curl 'http://localhost:5011/fts/?filter=foreground,ne_10m_admin_0_countries&searchtext=austr' + curl 'http://localhost:5011/fts/?searchtext=Country:austr' curl 'http://localhost:5011/fts/?filter=foreground,ne_10m_admin_0_countries&searchtext=qwc' curl -g 'http://localhost:5011/geom/ne_10m_admin_0_countries/?filter=[["ogc_fid","=",90]]' @@ -180,9 +183,9 @@ Examples: Docker usage ------------ -To run this docker image you will need a running Solr search service. +To run this service you will need a running Solr search service. -The following steps explain how to download the Solr search service docker image and how to run the `qwc-data-service` with `docker-compose`. +The following steps explain how to download the Solr search service docker image and how to run it with `docker-compose`. **Step 1: Clone qwc-docker** @@ -195,7 +198,7 @@ The following steps explain how to download the Solr search service docker image **Step 3: Start docker containers** - docker-compose up qwc-fulltext-search-service + docker-compose up qwc-solr For more information please visit: https://github.com/qwc-services/qwc-docker diff --git a/content/services/qwc-legend-service.md b/content/setup/services/qwc-legend-service.md similarity index 88% rename from content/services/qwc-legend-service.md rename to content/setup/services/qwc-legend-service.md index 4cddb134..1c35df67 100644 --- a/content/services/qwc-legend-service.md +++ b/content/setup/services/qwc-legend-service.md @@ -1,9 +1,11 @@ +++ -title = "QWC Legend Service" menuTitle = "qwc-legend-service" weight = 5 +chapter = false +++ +QWC Legend Service +================== Acts as a proxy between the client and the OGC service for GetLegendGraphic request, allowing to return custom legend graphics instead of the ones generated by the WMS server. @@ -11,6 +13,16 @@ allowing to return custom legend graphics instead of the ones generated by the W **Note:** Requires a QGIS server running on `default_qgis_server_url`. +### Usage + +Configure `legend_images_path` in the service configuration (see below). Then, legend images will be searched as follows + + * In `//.png`, where + * `service_name` is the name of the WMS service + * `layername` is the WMS layer name + * `suffix`: empty, or one of `_thumbnail`, `_tooltip`, see `type` query-parameter below. + * According to the `legend_image` paths set in the layer resource configurations of the legend service configuration. + Configuration ------------- @@ -18,7 +30,7 @@ The static config and permission files are stored as JSON files in `$CONFIG_PATH e.g. `$CONFIG_PATH/default/*.json`. The default tenant name is `default`. -### Data Service config +### Legend Service config * [JSON schema](schemas/qwc-legend-service.json) * File location: `$CONFIG_PATH//legendConfig.json` @@ -149,18 +161,6 @@ Example: } ``` - -### Legend images - -Place your custom legend images in `legend_images_path` and set the `legend_image` paths in the layer configurations accordingly. - -**TODO:** The service accepts a `type` query-parameter to distinguish three types of legend graphics: - - - `type=thumbnail`: Image for the thumbnails in the QWC2 layer tree - - `type=tooltip`: Image for the tooltips when hovering over the thumbnails in the QWC2 layer tree - - `type=default`: Default image, i.e. in the legend print or in the layer info dialog - - Usage ----- diff --git a/content/services/qwc-map-viewer.md b/content/setup/services/qwc-map-viewer.md similarity index 96% rename from content/services/qwc-map-viewer.md rename to content/setup/services/qwc-map-viewer.md index da2ac28a..4b2a2160 100644 --- a/content/services/qwc-map-viewer.md +++ b/content/setup/services/qwc-map-viewer.md @@ -1,9 +1,12 @@ +++ -title = "QWC Map Viewer Service" menuTitle = "qwc-map-viewer" weight = 1 +chapter = false +++ +QWC Map Viewer +============== + Provide a [QWC2 Web Client](https://github.com/qgis/qwc2-demo-app) application using QWC services. **Note:** Requires a QWC OGC service or QGIS server running on `ogc_service_url`. Additional QWC Services are optional. @@ -101,6 +104,14 @@ Main optional QWC services: * `search_service_url`: QWC Search Service URL * `search_data_service_url`: QWC Search Result Service URL +Additional user info fields may be read from the JWT identity by setting `user_info_fields`: +```json +"config": { + "user_info_fields": ["surname", "first_name"] +} +``` +These will be added as `user_infos` in the `config.json` response if present in the current identity. + `qwc2_config` contains the QWC2 application configuration, with `config` corresponding to the contents of your standalone `config.json` file (see [Documentation](https://github.com/qgis/qwc2-demo-app/blob/master/doc/QWC2_Documentation.md#application-configuration-the-configjson-and-jsappconfigjs-files)). `qwc2_themes` contains the full themes configuration, corresponding to the contents of your standalone `themes.json` collected from `themesConfig.json`. diff --git a/content/services/qwc-mapinfo-service.md b/content/setup/services/qwc-mapinfo-service.md similarity index 98% rename from content/services/qwc-mapinfo-service.md rename to content/setup/services/qwc-mapinfo-service.md index c03502b4..47259f59 100644 --- a/content/services/qwc-mapinfo-service.md +++ b/content/setup/services/qwc-mapinfo-service.md @@ -1,9 +1,12 @@ +++ -title = "QWC MapInfo Service" menuTitle = "qwc-mapinfo-service" weight = 8 +chapter = false +++ +QWC MapInfo Service +=================== + Additional information at a geographic position displayed with right mouse click on map. diff --git a/content/services/qwc-ogc-service.md b/content/setup/services/qwc-ogc-service.md similarity index 99% rename from content/services/qwc-ogc-service.md rename to content/setup/services/qwc-ogc-service.md index 5bdcd75a..052d0e53 100644 --- a/content/services/qwc-ogc-service.md +++ b/content/setup/services/qwc-ogc-service.md @@ -1,9 +1,11 @@ +++ -title = "QWC OGC Service" menuTitle = "qwc-ogc-service" weight = 2 +chapter = false +++ +QWC OGC Service +=============== Provide OGC services with permission filters as a proxy to a QGIS server. diff --git a/content/services/qwc-permalink-service.md b/content/setup/services/qwc-permalink-service.md similarity index 98% rename from content/services/qwc-permalink-service.md rename to content/setup/services/qwc-permalink-service.md index 80047592..8fc027bc 100644 --- a/content/services/qwc-permalink-service.md +++ b/content/setup/services/qwc-permalink-service.md @@ -1,9 +1,11 @@ +++ -title = "QWC Permalink Service" menuTitle = "qwc-permalink-service" weight = 6 +chapter = false +++ +QWC Permalink Service +===================== Stores and resolves compact permalinks for the Web Client. diff --git a/content/services/qwc-print-service.md b/content/setup/services/qwc-print-service.md similarity index 92% rename from content/services/qwc-print-service.md rename to content/setup/services/qwc-print-service.md index d58b85aa..e0dabfb5 100644 --- a/content/services/qwc-print-service.md +++ b/content/setup/services/qwc-print-service.md @@ -1,9 +1,16 @@ +++ -title = "QWC Print service" menuTitle = "qwc-print-service" weight = 7 +chapter = false +++ +QWC Print service +================= + +API documentation: + + http://localhost:5019/api/ + Configuration ------------- @@ -33,6 +40,12 @@ Example: "NAME" ] } + ], + "label_values": [ + { + "field": "USERNAME", + "value": "$username$" + } ] }, "resources": { diff --git a/content/services/qwc-registration-gui.md b/content/setup/services/qwc-registration-gui.md similarity index 95% rename from content/services/qwc-registration-gui.md rename to content/setup/services/qwc-registration-gui.md index 2facab8f..379b6234 100644 --- a/content/services/qwc-registration-gui.md +++ b/content/setup/services/qwc-registration-gui.md @@ -1,9 +1,11 @@ +++ -title = "Registration GUI" menuTitle = "qwc-registration-gui" -weight = 14 +weight = 13 +chapter = false +++ +Registration GUI for QWC Services +================================= Provides an application form, so users can submit group membership requests. diff --git a/content/troubleshooting/_index.md b/content/setup/troubleshooting/_index.md similarity index 98% rename from content/troubleshooting/_index.md rename to content/setup/troubleshooting/_index.md index 92367eb0..7928cbf7 100644 --- a/content/troubleshooting/_index.md +++ b/content/setup/troubleshooting/_index.md @@ -1,6 +1,6 @@ +++ title = "Troubleshooting" -weight = 7 +weight = 6 +++ Login redirects to http instead of https diff --git a/content/viewer/_index.md b/content/setup/viewer/_index.md similarity index 83% rename from content/viewer/_index.md rename to content/setup/viewer/_index.md index 04e4fc5b..c472cc7c 100644 --- a/content/viewer/_index.md +++ b/content/setup/viewer/_index.md @@ -1,9 +1,11 @@ +++ -title = "QGIS Web Client 2" menuTitle = "Viewer" weight = 3 +chapter = false +++ +# QGIS Web Client 2 Documentation + ## Introduction QGIS Web Client 2 (QWC2) is a modular next generation responsive web client for QGIS Server, built with ReactJS and OpenLayers. @@ -103,7 +105,7 @@ Some external services can be used to enhance the application. The reference imp |----------------------|-------------| |`permalinkServiceUrl` | Generates and resolves compact permalinks for the Share plugin. If empty, the full URL will be used. | |`elevationServiceUrl` | Returns elevation values, used to generate a height profile when measuring lines and display elevation information in the map right-click information bubble. If empty, the respective information will not be displayed in the client. | -|`editServiceUrl` | Service for editing features of layers served by QGIS Server. Required by the Editing plugin. | +|`editServiceUrl` | Service for editing features of layers served by QGIS Server. See [Editing](#editing). | |`mapInfoService` | Returns additional information to be displayed in the map right-click information bubble. If empty, no additional information will be displayed. | |`featureReportService`| Returns a custom document associated to a feature. See [`themesConfig.json`](#themesConfig-json). | @@ -193,7 +195,7 @@ Additionally, entries opening external URLs can be defined as follows: where -* `Key: An arbitrary key name (not used by existing plugins), used to lookup the the label for the entry from the translations. +* `Key`: An arbitrary key name (not used by existing plugins), used to lookup the label for the entry from the translations. * `icon`: As above. * `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`: 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. @@ -222,7 +224,7 @@ The first step is to prepare a QGIS project. Besides the common tasks of adding | 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. | +| 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. | #### Configuring the themes in `themesConfig.json` @@ -285,8 +287,9 @@ The format of the theme definitions is as follows: | `  {"s": , x: , y: }` | In this example, `{x: , y: }` will be used for ` > Scale >= `. | | `],` | | | `"printLabelForSearchResult": "",` | Optional, an ID of a print layout label to which the current search result text (if any) will be written to when printing. | +| `"printLabelForAttribution": "",` | 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. | -| `  "": {"rows": , "maxLength": },` | Height of the input field in rows and maximum number of allowed characters. | +| `  "": {"rows": , "maxLength": },` | Height of the input field in rows and maximum number of allowed characters. | | `},` | | | `"mapCrs: "",` | Optional, map projection, defaults to `EPSG:3857`. | | `"extent": [],` | Optional, override theme extent. In `mapCrs`. | @@ -304,7 +307,8 @@ The format of the theme definitions is as follows: | `"backgroundLayers": [{,` | Optional, list of available background layers. | | `  "name": "",` | Name of matching `BackgroundLayerDefinition`, see below. | | `  "printLayer": ""\|[],`| Optional, name of layer to use as matching background layer when printing. Alternatively, a list `[{"maxScale": , "name": ""}, ..., {"maxScale": null, "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": ` | Optional, initial visibility of the layer when theme is loaded. | +| `  "visibility": `, | Optional, initial visibility of the layer when theme is loaded. | +| `  "overview": `, | 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": [""],` | Optional, list of search providers IDs. An ID corresponds to the key of the exported `SearchProviders` object in `js/SearchProviders.js`. | | `"minSearchScaleDenom": ,` | Optional, minimum scale to enforce when zooming to search results. Takes precedence over value in `config.json`. | @@ -327,7 +331,8 @@ The format of the theme definitions is as follows: | `"mapTips":  \|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 WMS GetLegendGraphic. | | `"printLabelBlacklist":  ["", ...]` | Optional, list of composer label ids to not expose in the print dialog. | -| `"editConfig": ""` | Optional, object or path to a filename containing the editing configuration for the theme, see [EditingInterface.js](#editing-interface). | +| `"editConfig": ""` | Optional, object or path to a filename containing the editing configuration for the theme, see [Editing](#editing). | +| `"snapping": {...},` | Optional, snapping configuration, see [Snapping](#snapping). | | | `"config": {` | Optional, per-theme configuration entries which override the global entries in `config.json`.| | `  "allowRemovingThemeLayers": ` | See [`config.json`](#config-json-overrideable) for which settings can be specified here. | | `  ...` | | @@ -370,9 +375,9 @@ For external WMTS layers, the following additional parameters apply (you can use You can also set the "Data Url" for a layer in QGIS (Layer Properties → QGIS Server → Data Url) to a string of the form - wms:#? + wms:?# -(for instance, `wms:http://wms.geo.admin.ch#ch.are.bauzonen?tiled=false`), and an external layer pointing to the specified WMS service will automatically be created for the corresponding QGIS layer. +(for instance, `wms:http://wms.geo.admin.ch?tiled=false#ch.are.bauzonen`), and an external layer pointing to the specified WMS service will automatically be created for the corresponding QGIS layer. Note that this is currently only implemented for WMS layers. @@ -394,16 +399,17 @@ Background layers are handled completely client-side and do not appear in the la The format of the background layer definitions is as follows: -| Entry | Description | -|------------------------------|-----------------------------------------------------------------------------------| -| `"name": "",` | The name of the background layer, used in the theme definitions. | -| `"title": "", ` | The title of the background layer, as displayed in the background switcher. | -| `"thumbnail": "<Filename>",` | Optional, image file in `assets/img/mapthumbs`. Defaults to `default.jpg`. | -| `"type": "<Type>",` | The background layer type, i.e. `wms` or `wmts`. | -| `"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`](https://github.com/qgis/qwc2-demo-app/blob/master/themesConfig.json) for some examples. | +| 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": "<Menu title msgID>",` | Alternative to `title`, a message ID, translated through the translation files. | +| `"thumbnail": "<Filename>",` | Optional, image file in `assets/img/mapthumbs`. Defaults to `default.jpg`. | +| `"type": "<Type>",` | The background layer type, i.e. `wms` or `wmts`. | +| `"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`](https://github.com/qgis/qwc2-demo-app/blob/master/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. @@ -472,41 +478,100 @@ An advanced feature is the possibility to define parametrized search providers. Such entries are passed to the method `searchProviderFactory` in `js/SearchProviders.js`, which you can tweak to dynamically create a search provider definition based on the parameters specified in the entry. Refer to the [sample `js/SearchProviders.js`](https://github.com/qgis/qwc2-demo-app/blob/master/js/SearchProviders.js) for an example. -### <a name="editing-interface"></a>Implementing the editing interface in `js/EditingInterface.js` - -The QWC2 Editing plugin allows to add, remove and edit features from the map. For this to work, the following steps need to be performed: - -- The Editing plugin needs to be enabled in `config.json` and `appConfig.js`. -- The `editServiceUrl` needs to be specified in `config.json`. -- The server-side service needs to be set up. The [default editing interface](https://github.com/qgis/qwc2/tree/master/utils/EditingInterface.js) is the conterpart for the [QWC data service](https://github.com/qwc-services/qwc-data-service). You can also use a custom editing service, in which case you need to implement a custom EditingInterface and pass it to the Editing plugin in `appConfig.js`. -- For every theme for which editing is allowed, a matching `editConfig.json` needs to be implemented and specified in the corresponding entry in `themesConfig.json`. - -The format of the `editConfig.json` is as follows: - -| Entry | Description | -|-------------------------------------|---------------------------------------------------------------| -| `{` | | -| `  <LayerId>: {` | A WMS layer ID. Should be a theme WMS layer name, to ensure the WMS is correctly refreshed. | -| `    "layerName": "<LayerName>",` | The layer name to show in the selection combo box. | -| `    "geomType": "<GeomType>",` | The geometry type, either `Point`, `LineString` or `Polygon`. | -| `    "displayField":  "<FieldId">",`| The ID of the field to use in the feature selection menu. | -| `    "fields": [{` | A list of field definitions, for each exposed attribute. | -| `      "id": "<FieldID>",` | The field ID. | -| `      "name": "<FieldName>",` | The field name, as displayed in the editing form. | -| `      "type": "<FieldType>",` | A field type. Either `bool`, `list` or a regular [HTML input element type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). | -| `      "constraints": {` | Constraints for the input field. | -| `        "values": [<Entries>],` | Only if `type` is `list`: an array of arbitrary strings. | -| `        ...` | For regular HTML input types, the ReactJS API name of any applicable [HTML input constraint](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input), i.e. `maxLength` or `readOnly`. | -| `      }` | | -| `    }],` | | -| `    "form": "<PathToUiFile>",` | As alternative to `fields`, a QtDesigner UI file. See below. | -| `  }` | | -| `}` | | +### <a name="editing"></a>Editing support + +QWC2 offers comprehensive editing support through a variety of plugins: + +- The `Editing` plugin allows creating, editing and removing features of an editable vector layer. It supports editing both geometry and attributes, displaying customizeable attribute forms. +- The `AttributeTable` plugin also allows creating, editing and removing features of an editable vector layer. It displays all features of the editable layer in a tabularized view, and allows editing attributes, but not geometries. +- The `FeatureForm` works similarly to the feature-info, but also allows editing the attributes and geometry of a picked feature. It can be used as `identifyTool` instead of the standard `Identify` plugin. + +To configure editing in QWC2, you need to follow the following steps: + +- Set up an editing backend. You can use the readily available [QWC data service](https://github.com/qwc-services/qwc-data-service), or a custom backend. +- Enable the desired editing plugins in `appConfig.js`. If you use a custom editing backend, you'll most likely need to implement a custom editing interface and specify it in `appConfig.json`, see the comment above `EditingPlugin` in [`js/appConfig.js`](https://github.com/qgis/qwc2-demo-app/blob/master/js/appConfig.js). +- If you are using qwc-services, the [QWC config generator](https://github.com/qwc-services/qwc-config-generator) and [QWC map viewer](https://github.com/qwc-services/qwc-map-viewer) will automatically generate a suitable `editConfig` for each editable layer and embed it in the `themes.json`, otherwise you need to write a custom `editConfig` in `themesConfig.json` as described below. + +As a backend, you can use the readily available [QWC data service](https://github.com/qwc-services/qwc-data-service). Please consult its README detailed information including how to set up the edit forms. + +If you use a custom backend, you will need to implement a corresponding editing interface in `js/EditingInterface.js`. + +If you don't use the [QWC config generator](https://github.com/qwc-services/qwc-config-generator) and [QWC map viewer](https://github.com/qwc-services/qwc-map-viewer), you will also need to write the `editConfig` block in `themesConfig.json` as follows: + +| Entry | Description | +|--------------------------------------|---------------------------------------------------------------| +| `{` | | +| `  <LayerId>: {` | A WMS layer ID. Should be a theme WMS layer name, to ensure the WMS is correctly refreshed. | +| `    "layerName": "<LayerName>",` | The layer name to show in the selection combo box. | +| `    "editDataset": "<DatasetName>",`| The name of the edit dataset passed to the editing interface. | +| `    "geomType": "<GeomType>",` | The geometry type, either `Point`, `LineString` or `Polygon`. | +| `    "displayField":  "<FieldId>",` | The ID of the field to use in the feature selection menu. | +| `    "permissions": {` | A list of different write permissions to specify rights and buttons. | +| `      "creatable": <boolean>,` | If `true`, `Draw` button will appear in Editing interface and `Add` button in Attribute Table. | +| `      "updatable": <boolean>,` | If `true`, `Pick` button will appear in Editing interface. | +| `      "deletable": <boolean>,` | If `true`, `Delete` button will appear in Editing interface and Attribute Table. | +| `      },` | | +| `    "fields": [{` | A list of field definitions, for each exposed attribute. | +| `      "id": "<FieldID>",` | The field ID. | +| `      "name": "<FieldName>",` | The field name, as displayed in the editing form. | +| `      "type": "<FieldType>",` | A field type. Either `bool`, `list` or a regular [HTML input element type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). | +| `      "constraints": {` | Constraints for the input field. | +| `        "values": [<Entries>],` | Only if `type` is `list`: an array of arbitrary strings. | +| `        ...` | For regular HTML input types, the ReactJS API name of any applicable [HTML input constraint](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input), i.e. `maxLength` or `readOnly`. | +| `      }` | | +| `    }],` | | +| `    "form": "<PathToUiFile>",` | As alternative to `fields`, a QtDesigner UI file. See below. | +| `  }` | | +| `}` | | * If you specify `fields`, a simple form is autogenerated based on the field definitions. * If you specify `form`, you can specify the URL to a Qt Designer UI form (use `:/<path>` to specify a path below the `assets` folder). Most basic input elements provided by QtDesigner are supported, see [this sample form](https://github.com/qgis/qwc2-demo-app/blob/master/assets/forms/form.ui). The widget names must be set equal to the attribute names. -See the [sample `editConfig.json`](https://github.com/qgis/qwc2-demo-app/blob/master/test2056_edit.json) for a full example. See also the [QWC data service README](https://github.com/qwc-services/qwc-data-service/blob/master/README.md). +See the [sample `editConfig.json`](https://github.com/qgis/qwc2-demo-app/blob/master/test2056_edit.json) for a full example. + +### <a name="snapping"></a>Snapping support + +QWC2 ships a plugin for snapping support while drawing (redlining / measuring / editing). To enable it, make sure the `SnappingSupport` plugin is enabled in `appConfig.js` (see the sample [sample `js/appConfig.js`](https://github.com/qgis/qwc2-demo-app/blob/master/js/appConfig.js)). Then, for each theme for which you want snapping to be available, you can add a `snapping` block to your theme item in `themesConfig.json` as follows: + + ... + "snapping": { + "snaplayers": [ + { + "name": "<layername>", + "min": <min_scale> + "max": <max_scale> + } + ], + "featureCount": <feature_count> + } + ... + +where: + +- `layername` is the name of the theme sublayer from which to retreive the snapping geometries +- `min` is the minimum scale denominator (inclusive) from which this layer should be used for snapping +- `max` is the maximum scale denominator (exclusive) up to which this layer should be used for snapping +- `feature_count` is the maximum number of snapping geometries to retreive for the current map extent (default: 500). + +Snapping works by querying the geometries of all snapping layers inside the scale range via WMS GetFeatureInfo and refreshing the geometries every time the map extent changes. Therefore, it is recommended to ensure the geometry complexity of the snap layers is appropriate for the specified scale ranges to avoid overloading the server with the GetFeatureInfo requests. Also, the QGIS project will need to be configured to add geometries to the feature info responses. + +For the `Redlining`, `Measure` and `Editing` plugins, the availability of snapping can be independently configured: + + { + "name":"<Redlining|Measure|Editing>", + "cfg": { + "snapping": <true|false>, + "snappingActive": <true|false>, + ... + } + } + +where: + +- `snapping` determines whether snapping is available for the specified plugin +- `snappingActive` determines whether snapping is active by default for the specified plugin + +When snapping is available, a small toolbar appears on the bottom border of the map with the possibility to toggle snapping. ### <a name="translations"></a>Managing translations