Use of webservices in QGIS
What is a webservice?
Webservices are making it possible to share geographical and non geographical information by the web. A webservices provides you an access to the most up to date data available, and can save you time worrying about a data visualisation or about processing time.
For geographical data, webservices have been standardised by the Open Geospatial Consortium. The most important services for geospatial use are:
- WMS: This webservice sends you a piece of a map.
- WFS: This webservice sends you a piece of data.
If you only need to visualize a layer in your project, the best option is to use a WMS. If you need to analyse the data, you can consider using a WFS service. Be carefull when using WFS services with big data.
How to use webservices?
Webservices can be used to visualise cartographical information on websites, in scripts to analyse data or in all kind of applications. This manual explains how to use webservices in QGIS. This software is the standard software fot GIS-applications for Brussels Mobility.
The screenshots or made in version 3.28 of QGIS.
Copying the webservice url
Create a webservice connection
-
Open QGIS.
-
Open the Data Source Manager.
Layer > Data Source Manager (Ctrl + L)
-
Open the menu 'WMS/WMTS' or 'WFS / OGC API - Features', dependant on the webservice you want to use.
-
Create a new connection by clicking on 'new' (3).
-
Choose a name to title the new connection and paste the capabilities url in the field 'URL'.
-
If the access to this data source is restricted, you have to add authentication parameters. You can find how to do this in at the end of this manual. If the data source is not restricted, you can click 'ok' to create the connection.
Add the dataset to your project
More info
QGIS user manual: https://docs.qgis.org/3.34/en/docs/user_manual/working_with_ogc/ogc_client_support.html
Adding authentication
Mobigis uses Keycloak as access management system. The system is configurated in a way that every registered user can receive a client secret and client id, which makes it possible to request a bearer token.
-
Open your client page. You will be asked to login, if your not logged in. If you allready created a client id, your details will be shown. If this is the first, time you access this page, you will be asked to do this.
-
Click on the button 'Get QGIS configuration file' you can find in the 'In QGIS' section. A json configuration file will be downloaded.
-
Open the 'Datasource Manager' in QGIS. Edit the webservice where you have to add the authentication.
-
Add an authentication configurations clicking on the green '+' button. Authentication configurations you configured before will be available in the dropdown list.
-
Chose a name for your configuration and select 'OAuth2 authentication' in the dropdown.
-
Import the configuration file (blue icon). This file complete the fields of the configuration. The only field you still have to fill in is your password (don't forget to update your password if necessary!).
-
Save the configuration and test it.