Introduzione

Il tutorial è basato su un progetto QGIS dedicato alla gestione di un layer rappresentante una serie di edifici dislocati sul territorio.

Oltre agli aspetti geografici il progetto prevede la gestione di numerosi e diverisficati attributi e di eventauli interventi di manutezione tramite una relazione di tipo 1:n

Tramite questo tutorial sarà possibile:

  • personalizzare i vari aspetti grafici-funzionali del progetto demo

  • pubblicare il progetto come servizio WebGis

  • creare ricerche personalizzate

  • add plots made with DataPlotly QGIS plugin

  • attivare la funzionalità di editing personalizzando form e widget associati

_images/demo_qgis_project.png

_images/demo_webgis_project.png

Download demo data

The tutorial is based on predefined data and QGIS 3.22.x LTR project downloadable from this link.

The .zip file contains the G3W-SUITE directory with three sub directories:

  • projects: containing a QGIS project (buildings_management.qgs) already optimized for the tutorial

  • project_data/spatialite: containing a SpatiaLite DB with basic data (build_management_demo.sqlite)

  • plots: containing a a series of plots created with the DataPlotly plugin and saved in xml format

_images/demo_zip_file.png

Inside the build_management_demo.sqlite SpatiaLite DB there are the following layers:

  • buildings (layer poligonale): layer di riferimento per gli aspetti di editing

  • maintenance_works (tabella alfanumerica): con gli interventi di manutenzioni associati ai singoli edifici

  • buildings_rating (alphanumeric table): with the annual assessments relating to individual buildings

  • roads (linear layer): layer to define the address associated to any buildings

  • work_areas (layer poligonale): con la perimetrazione di aree di lavoro da utilizzare per definire eventuali geo-constraints

  • type_subtype (alphanumeric table): a decoding table of the type and subtype values associated with the individual buildings

IMPORTANTE: per il corretto funzionamento della demo, una copia dei dati geografici è presente sul server. La modifica dei dati potrebbe ripercuotersi sulla pubblicazione del progetto

The project (based on QGIS LTR 3.22.x) foresees:

  • una vestizione categorizzata dal layer buildings basata sul campo categorico type

  • the presence of a 1: n relationship between the buildings layer and the alphanumeric maintenance_works and buildings_rating tables

  • query form prestutturati per il layer buildings e la tabella maintenance_works

  • predefined editing widgets for the fields of the two main layers: buildings , maintenance_works and buildings_rating tables

  • two standard print layout in A4 and A3 and an two atlas print layout based on buildgs layer features

_images/demo_qgis_project.png

Modificare il titolo del progetto QGIS

Il sistema di pubblicazione prevede l”utilizzo del titolo del progetto come identificatore univoco del servizio WebGis

*Per questo, prima di pubblicare i progetto sarà quindi necessario modificare il titolo associato al progetto base (Progetto -> Proprietà... - Sessione: Generale)

_images/qgisserver_change_title.png

Accedere al servizio on line

To publish the project, you can access the G3W-SUITE test application via the following URL: https://v33.g3wsuite.it

Per accedere al Pannello di Amministrazione è necesario loggarsi tramite le seguenti credenziali:

  • user: demo

  • password: G3wsuite!

In case of login fails, report the problem to info@gis3w.it

Pubblicare il progetto QGIS come servizio WebGis

In seguito ad autenticazione sarà possibile accedere alla Sessione di Amministrazione e visualizzare la Dashboard.

Nella Dashboard sarà presente il menù per l”accesso ai Gruppi Cartografici di competenza del vostro utente e i menù relativi ad ulteriori moduli non attivi in questa demo.

Clicca sulla voce Mostra nella casella celeste Gruppi per accedere all”elenco dei Gruppi Cartografici disponibili.

_images/demo_dashboard.png

Accedi all”elenco dei webgis presenti nel Gruppo Cartografico G3W-SUITE Demo facendo click sul numero di progetto riportato.

_images/demo_choose_group.png

_images/demo_project_manage.png

Ora clicca sul pulsante _images/button_add_qgis_project.png per pubblicare il tuo progetto QGIS.

Compilate il form definendo i vari aspetti da associare al servizio WebGis in pubblicazione:

Progetto QGIS

File QGIS*: caricare il progetto cartografico di QGIS da pubblicare (file .qgz o .qgs)

ACL Users

Gestione poteri di accesso e gestione

  • Utenti Viewers: si definiscono i singoli utenti (Viewers) che hanno le credenziali per visualizzare il servizio WebGis. Scegliendo l”utente anonimo (AnonymusUser) il gruppo sarà ad accesso libero

  • Gruppi di utenti Viewer: si definiscono i gruppi di utenti (Viewer) he hanno le credenziali per visualizzare il contenuto del servizio.

BaseLayer

In questa sessione si va a definire quale base layer deve essere attivo all”avvio.

La scelta è limitata alla lista degli strati di base attivati per il gruppo cartografico nel quale si lavora.

E” possibile anche non definire nessun strato di base attivo all”avvio.

Descrizione

  • Titolo pubblico: Titolo da associare al progetto e visualizzato sull”header del client.Se lasciato vuoto verrà utilizzato il titolo associato al progetto QGIS o, in mancanza di questo, il nome del file di progetto

  • Descrizione: descrizione libera del progetto che apparirà a livello del portale pubblico.

  • Thumbnail (Logo): logo da associare al progetto. Tale immagine sarà visibile in associazione con il progetto

  • URL alias: E” possibile impostare un alias per la parte finale dell”URL della mappa.

ATTENZIONE: contenuti segnati con asetrisco sono obbligatori

Options and actions

Choose your preferred options regarding the following options:

  • User QGIS project map start extent as webgis init extent: check this control if you want set initial extent from QGSI project initial extent, Project properties -> QGIS Server -> WMS capabilities (Advertised extent)

  • Tab's TOC active as default: set tab’s TOC (Layers, Base layers, Legend) open by default on startup of webgis service

  • Legend position rendering: this option allows to set legend rendering position:

    • In a separate TAB: default value, the legend is rendered into a separate tab

    • Into TOC layers: the legend is rendered inside layers toc

  • Automatic zoom to query result features: if in the results of a search there are only features of a layer, the webgis automatic zoom on their extension

_images/g3wsuite_administration_project_add_option.png

Compilati i campi di interesse si clicca sul tasto Salva per confermere la pubblicazione

_images/buttom_save.png

Se la pubblicazione è andata a buon fine il progetto QGIS apparirà nell”elelnco dei progetti presenti nel Gruppo Cartografico

Cliccando sull”icona Visualizza mappa si accederà al servizo WebGis in consultazione.

_images/demo_webgis_project.png

Aggionare il servizo WebGis pubblicato

Se volete modificare alcuni aspetti grafico-funzionali del vostro servizio WebGis, modificate il vostro progetto QGIS e aggiornate il servizio WebGis cliccando sull”icona Modifica _images/iconsmall_edit.png

Nel form visualizzato ricaricate il progetto QGIS con le vostre modifiche e cliccate sul tasto Salva

Attivazione funzioni aggiuntive

Una volta che il tuo progetto è stato pubblicato, puoi accedere all”elenco dei widget e funzioni aggiuntive per arricchire il tuo servizio WebGis.

Gestione widget

Per accedere alla gestione delle funzioni aggiuntive cliccate sull”icona Lista Layers _images/iconsmall_layerlist.pnga livello del vostro progetto QGIS

_images/demo_project_manage.png

La nuova sessione mostrerà la lista dei layer presenti nel progetto QGIS pubblicato

_images/g3wsuite_administration_project_layer_list.png

  • Etichetta: alias del layer applicata a livello di progetto QGIS

    • The eye icon allows you to know the ID associated with the layer at the project level, this ID will be useful for creating parameterized URLs

  • Name: name of the layer (file or DB table)

  • _images/icon_layertype.png Type: illustra il tipo di dato (WMS, PostGis, SpatiaLite, GDAL/OGR…)

  • WMS esterno: per accelerare il caricamento, i layer WMS presenti in un progetto QGISsono gestiti direttamente da Django e non da QGIS-Server. Tuttavia,questo metodo impedisce l”applicazione di qualsiasi stile (ad es. livello di opacità)definito a livello di progetto. La scelta dell”opzione WMS esternasignifica che il layer WMS è gestito direttamente da QGIS-Server e quindipuò essere applicato lo stile associato.

  • WFS: una spunta mostra se il layer è pubblicato o meno come servizio WFS

  • Actions: a series of icons dedicated to various functions

    • _images/icon_cache.png Cache del layer: ti permette di attivare e gestire la cache del layer

    • _images/icon_editing.png Editing layer: mostra se la funzione di modifica online è attiva sul layer e ti permette di attivarlo e definirlo

    • images/manual/icon_filter_layer.png Hide layer by user/groups: hide specific layers from the TOC based on specific users or groups of users

    • _images/icon_dataplotly.png QPlotly widget: add or manage plots created with DataPlotly QGIS plugin

    • _images/icon_geoconstraints.png Geo-constraints by user/group: create or manage editing and visualization geo-constraints based on poligonal layers

    • _images/icon_alpha_constraints.png Alphanumeric and QGIS expressions constraints by user/groups: create or manage editing and visualization constraints based on SLQ language or QGIS expressions

    • images/manual/icon_hide_columns.png Hide columns by User/Groups: create or manage constraints on one or more fields of a layer based on single or group user/s

    • _images/icon_widget.png Widgets list: shows how many widgets (eg searches) are associated with this layer and allows you to activate new ones

    • images/manual/icon_styles.png Manage layer styles: manage multi-style layer

  • Not show attributes table: hide attributes table of the layer for every users

  • No legend: consente di definire se il layer deve o meno essere presente nella legendadel client Web

  • Download: allows the download of the geographic and not geographic layers in various formats

    • Download as shp/geotiff: for vector and raster layers

    • Download as GPK: for geographic or not geographic layers

    • Download as xls: for all types of layers, in .xls format

    • Download as csv: for all types of layers, in .csv format

    • Download as gpx: for geographic layers, in .gpx format

The number above each Action icon shows if and how many related objects are present.

Prova ad attivare le opzioni disponibili e verificare il risultato refreshando il servizio WebGis

Creazione strumenti di ricerca

Per creare uno strumento di ricerca disponibile a livello WebGis, selezionare il layer vettoriale su cui basarsi per creare lo strumento e fare clic sull”icona Elenco widget _images/icon_widget.png

NB: there may be a number of searches created by other users for the same layer.

E” possibile attivarle cliccnado sul check Collegato

_images/g3wsuite_administration_project_widget_list.png

Le ricerche elencate possono essere modificate, cancellate o scollegate usando lerelative icone.

Per creare una nuova ricerca, fai clic sul link blu Nuovo widget

Nel form è possibile definire:

  • Titolo del form

    • Type: «Search»

    • Nome: nome che utilizzerà G3W-SUITE per registrare internamente il widget di ricerca.

  • Configurazione generale delle ricerca e risultati

    • Titolo ricerca: titolo che identifica la ricerca che diverrà disponibile nel pannello Ricerche dell”interfaccia WebGis

  • Impostazioni campi di ricerca

    • Campo: campo su cui realizzare la ricerca

    • Widget: method of entering the value to be searched InputBox: manual compilation SelectBox: values ​​shown via drop-down menu AutoCompleteBox: values ​​shown through auto-complete mode

    • Alias: alias assegnato al campo che comparirà nel form di ricerca

    • Descrizione: descrizione assegnata al campo

    • Operatore comparizione: operatore di comparazione (=, <, >, ><, >=, <=, LIKE, ILIKE) tramite qui verrà realizzata la query di ricerca. Gli operatori LIKE e ILIKE saranno disponibili solo per layer PostGis o SpatiaLite

    • Dipendenza: questo parametro (facoltativo) permette, solo nel caso di widget SelectBox, di elencare la lista dei valori di un campo filtrati in base al valore definito per i campi precedenti. Lo strumento permette, ad esempio, di mostrate, nel menù a tendina dedicato alla scelta delle particelle catstali, solo le particelle collegate al foglio scelto nell’opzione precedente. Tale funzione è disponibile solo per layer PostGis o SpatiaLite.

Now it is possible to define the dependence more or less strong (strictly).

In case of strictly dependence, the values of the dependent fields will be loaded only after the choice of the value of the field on which the dependency depends.

Otherwise it will be possible to define the values of the individual fields freely and without a specific order. The values available for the other fields will in any case depend on the choice made.

The button _images/button_add.png allows you to add additional fields for the construction of the search query currently manageable through AND/OR operators.

The example below shows the compilation of the form for creating a search widget dedicated to a cadastral cartography layer.

_images/g3wsuite_administration_project_search_form.png

Una volta compilato il form si clicca sul tasto OK per salvare le impostazioni.

Salvate le impostazioni il widget realizzato comparirà nella lista dei Widget associati al layer.

Il widget risulterà già Collegato e quindi disponibile nell”inerfaccia WebGis.

_images/demo_search_result.png

Plots widget

Add plots created using QGIS DataPlotly (a great plugin developed by Matteo Ghetta) in the cartographic client.

The module, based on the Plotly library, manages plots saved as xml.

The plots are connected to the layers defined on the QGIS project, in this way, as for the searches and the constraints, it is possible to activate the same plots on all WebGis services in which the reference layer is present.

For this reason, there may be some plots created by other users for the same layer. You can activate them by clicking on the Linked chekbox.

_images/g3wsuite_administration_plots.png

The title of the chart, defined at the plugin level, will be the unique identifier.

Try to create your plots in the QGIS project, save them as .xml and upload them to view the resluts on the webgis.

_images/g3wsuite_qgis_plots.png

_images/g3wsuite_client_plots.png

The graphs are filterable based on the:

  • images/manual/g3wclient_plots_map_filter.png features visible on the map

  • images/manual/g3wclient_plots_selection_filter.png filter based on the selected features

These filters are also reflected on the plots associated to the related data (in 1:N mode) based on the visible and/or selected parent features.

The filter based on the map content can be activated globally on all plots (icon at the top of the panel dedicated to charts) or on only some specific plots (icon placed at the level of the individual plots).

The plots will automatically update after pan and zoom operations on the map

If activated, the filter based on the selected features is automatically activated on all related plots (associated with the same layer and with the 1:N relationed tables)

Appropriate messages at the single plots level will indicate the activation of these filters.

If 1: N relationships are associated with the interrogated layer and plots have been activated on the referencing tables, it will also be possible to consult these plots by querying the referenced layer and clicking on the Show relation charts icon present in the results form.

images/manual/g3wclient_attribute_view_plots.png

Show relation charts: display of graphs related to 1: N related data. Only if 1: N relationships are associated with the interrogated layer and graphics have been activated on the boy tables.

Editing on line

Query form e widget di modifica sono già definiti nel progetto per il layer: buildings e per la tabella relazionata ``*maintenance_works.

  • Buildings

    • id (integer - primary key): autogenerate

    • name (text NOT NULL): text edit

    • address (text): Value relation (roads layer - code/name fileds)

    • zone (text): text edit (with default values based on a QGIS expression to for association with the intersecting works area)

    • type (text NOT NULL): unique values (Administrative, Commercial, Residential)

    • subtype (text NOT NULL): value relation (based on type_subtype table for a drill-down cascading forms)

    • attachment (integer): check box 1/0 (the visibility of the conditional form Documents is based on this field)

    • photo (text): attachment

    • link (text): text edit

    • form (text): attachment

    • user (text): text edit (automatically filled in with the G3W-SUITE username creator of the feature)

    • year (integer NOT NULL): unique values (2015,2016,2017,2018,2019,2020)

    • high (integer NOT NULL): range (10-30 step 2)

    • volume (integer): range (50-200 step 10)

    • surface (integer): text edit

    • architectural_barriers (text): Checkbox (Checked - Not checked)

    • date_barriers (date): date (yyyy/MM/dd)

    • safety_exits (text): checkbox (Checked - Not checked)

    • date_exits (date): date (yyyy/MM/dd)

    • fire_system (text): Checkbox (Checked - Not checked)

    • date_fire (date): date (yyyy/MM/dd)

  • Maintenance_works

    • id (integer - primary key): autogenerate

    • id_buildings (text - relation key): text edit

    • maintenance (text NOT NULL): unique values

    • date (date): date (yyyy/MM/dd)

    • form (text): attachment

    • value (integer): range (10-30 step 2)

    • outcome (text): unique values (good, medium, bad)

    • responsible (text): text edit

    • cost (integer): range (1000-5000 step 1)

    • validation (boolean): checkbox (0/1)

  • Buildings rating

    • id (integer - primary key): autogenerate

    • id_buildings (text - relation key): text edit

    • date (date): date (yyyy/MM/dd)

    • value (integer): range (1000-4000 step 500)

    • year (integer): range (2018-2022 step 1)

To activate the editing function on webgis, access the list of layers and identify the three layers shown above.

_images/g3wsuite_administration_project_layer_list.png

Cliccando sull”icona Editing layer _images/icon_editing.png (posizionata a sinistra di ogni layer) si aprirà un modale che permetterà di:

  • definire la scala di attivazione del”editing (solo per le tabelle geometriche)

  • definire gli utenti Viewer (singoli o gruppi) abilitati all”editing online «

Gli utenti Viewers (singoli o gruppi) disponibili nel menù a tendina saranno limitati a quelli che hanno permesso di accesso in consultazione al progetto WebGis in cui è contenuto il layer

_images/editing_setting.png

Attivata la funzione di editing, aggiornando il servizio WebGis, la voce Strumenti apparirà sul pannello di sinistra.

Attivando la funzione di editing sarà possibile modificare gli attributi delle features del layer degli edifici pubblici e dei relativi interventi di manutenzione

_images/editing_client_start.png

_images/demo_editing_web.png

_images/editing_form2.png

Per ulteriori informazioni sulla funzione di editing web, leggi il capitolo dedicato sul manuale.

Personalizza la tua demo

Vuoi testare più in profondità la funzione di editing?

Ridefinisci gli attribut form, gli alias e i widget di modifica associati ai singoli campi e ricarica il progetto per verificare le nuove impostazioni.

Prima però consulta il paragrafo dedicato all”elenco e alle limitazioni sui singoli widget di modifica ereditabili dal progetto QGIS