Giter VIP home page Giter VIP logo

qwc2_plugin's Introduction

The QWC2 plugin allows to publish and update QGIS projects on the web from QGIS desktop.

The plugin has an associated server component that lives in the QWC2 microservices ecosystem.

Below is a blueprint of the architecture .

From the user to the application

There are two prerequisites :

  • To open the plugin window and add a new project in the application, it is necessary to have a QGIS (.qgs) project opened in QGIS Desktop. Once the window is opened the user can also configure projects that are already published. If the user only wants to modify an existing project, he must open it in QGIS Desktop to open the QWC2 plugin configuration window.

  • The user also needs to know the url of the server, his/her username and password.

To a better understanding of what we realised, we propose here a short video of the plugin :

As you can see, the first step is to create and configure your project in QGIS Desktop : symbology, QGIS Server services. After you click on the button a window appears where the user gives the url server, username and password. Clicking on "test connection" allows the connection to the server and add information about projects already in the app and the project you want to add in the interface. You can modify informaiton and then click OK to add the project in the application. After some minutes, the project is in the app! If you refresh your web page you can see the project and the symbology you choose.

To test the plugin... how it works now

Clone this repository in the QGIS plugin folder:

git clone <this repository> ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qwc2_plugin

Run the server component locally:

cd  ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qwc2_plugin
virtualenv -p python3 venv
. venv/bin/activate
pip install -r requirements.txt
python server.py

For now, there is a configuration file (the same as in qwc-config-generator) defined in server.py. It is located in your QWC2 installation directory, for example, here /opt/qwc2/qwc-services/config-in/default/tenantConfig.json.

Open QGIS desktop, create a QGIS project, configure QGIS server services (WMS, WFS...), activate the plugin and click on the QWC2 icon in the plugin toolbar (the third one)

The configuration dialog opens:

It is divided in two parts:

  • in the authentication part, the user completes the required information to connect to the server. The user clicks on test connection to check url and credentials and get the current configuration.
  • in the project part, updated information about projects from the tenantConfig.json is displayed. The default displayed project is the one currently opened in QGIS. The user can switch on all projects already on the server and configure them one by one: scales, background, default background and searchproviders. When the user clicks on ok, new configuration is sent to the server and qwc-config-generator generates new files.

We created a micro service with Flask to :

  • connect plugin to QWC2 application
  • copy QGIS project on the server
  • update configuration of qwc-config-generator
  • generate new configuration, thanks to qwc-config-generator

Also, thanks to server.py, you can download zip file of the plugin directory to install it in QGIS. For example, you can download it at https://qgisweb.oslandia.net/plugin/download.

Way to improve it... how it will work

Some improvements that we can think of after that:

  • control if QGIS Server services in the project are activated,
  • transfer layers symbols to the server (e.g. in case of custom svg symbols)
  • transfer datasources (shapefiles, geopackages) to the server if the data used by the project is not already available "online" (note: the server typically hosts a PostGIS server)

Talk about it ...

We already talk about this plugin in the mailling list QWC2 and in an issue on github.

Feel free to add comments or/and suggest changes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.