Skip to content

Commit

Permalink
adding ows data to qgis
Browse files Browse the repository at this point in the history
  • Loading branch information
pvgenuchten committed Feb 16, 2024
1 parent 03ab1d2 commit 6169716
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 1 deletion.
Binary file added docs/cookbook/img/qgis/add-layer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/cookbook/img/qgis/add-layer2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/cookbook/img/qgis/add-service.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/cookbook/img/qgis/add-wfs-layer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/cookbook/img/qgis/export-features.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/cookbook/img/qgis/sensor-observations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/cookbook/img/qgis/zoom-to-layer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions docs/cookbook/ows-in-qgis.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: Interact with Spatial data services using QGIS Desktop
date: 2024-02-16
author: Paul van Genuchten
---

[QGIS](https://qgis.org) is an open source desktop GIS application available for Windows, MacOX, Linux and Android. It supports a wide variety of spatial formats, spatial data services, digitisation tools and spatial processing tools. If you are not familiar with QGIS, follow the [getting started tutorial](https://qgis.org/en/site/forusers/) first.

## Visualize data using OGC:WMS

[OGC:WMS](https://www.ogc.org/standard/wms/) visualizes data in a mapviewer. To display a WMS in QGIS, Select from the menu `Layer > Add Layer > Add WMS/WMTS Layer`. This opens the Add layer panel.

![Add WMS Layer](./img/qgis/add-layer.png){.w-50 .border .shadow}

First we are adding a new service. Select the `New` button.

![Add WMS service](./img/qgis/add-service.png){.w-50 .border .shadow}

With the service selected, click the connect button and the layers available in the service are displayed

![Select a layer](./img/qgis/add-layer2.png){.w-50 .border .shadow}

Select the relevant layer and click `Add` at the bottom of the panel. The Layer is now displayed on the map. If you don't see it yet, right click the layer on the table of content and select `Zoom to layer`.

![Zoom to layer](./img/qgis/zoom-to-layer.png){.w-50 .border .shadow}

Understand that you can not select features, because the interaction with the service is based on images. You can however use the `i` tool to retrieve attribute information from pixels. A dedicated method on the service, called 'getFeatureInfo' is used.

## Visualize and download vector data using OGC:WFS or OGCAPI:Features

[OGC:WFS](https://www.ogc.org/standard/wfs) retrieves vector features from a dataset. [OGCAPI:Features](https://ogcapi.ogc.org/features/) is a modern alternative to WFS, supported by some servers. Adding a WFS or Features layer to QGIS uses a similar procedure as adding a WMS layer. Select `Layer > Add layer > Add WFS layer` from the menu. Notice that only vector layers are shown, grid layers use the WCS protocol (see next paragraph).

![Add WFS Layer](./img/qgis/add-wfs-layer.png){.w-50 .border .shadow}

Notice the `build query` button in the footer of the panel. This allows you to filter features on attribute value, for example `pH < 5`. Substantially less data will be retrieved, improving the performance.

With the layer added to the view, notice that the data has no styling, it acts as any other vector dataset. You can select features and even open the attribute table.

To extract a subset of the data, zoom to the area of interest, then right click the layer in the table of contents and select `Export > Save Features As`.

![Export WFS data](./img/qgis/export-features.png){.w-50 .border .shadow}

On the export panel, set the format, a file location and set the extent (current). Then select `OK`.

## Visualize and download grid data using OGC:WCS

[OGC:WCS](https://www.ogc.org/standard/wcs) retrieves subsets from a grid dataset. Adding a WCS layer to QGIS uses a similar procedure as adding a WFS layer. Select `Layer > Add layer > Add WCS layer` from the menu.

The WCS layer acts like any grid layer, you can retrieve the pixel value and run grid processes on the layer.

Exporting a grid for a region of interest works similar as WFS.

## Visualize and download observation data using Sensorthings API

Soil observation data is best made available through [Sensorthings API](https://www.ogc.org/standard/sensorthings/). Sensorthings API is not a default supported format of QGIS. You need to install the [Sensorthings Plugin](https://github.com/AirBreak-UIA/SensorThingsAPI_QGIS-plugin).

With the plugin installed, you can add a layer of type Sensortings via `Layer > Add layer > Upload layer from remote server`. Use for example the [service of
Comune di Ferrara, Italy](https://iot.comune.fe.it/FROST-Server/v1.1/Locations). As soon as the sensor locations show on the map, you can select 'Show location information' tool from the plugin menu and select a sensor. And view or download the observations at that location.

![Sensor observations](./img/qgis/sensor-observations.png){.w-50 .border .shadow}

2 changes: 1 addition & 1 deletion docs/cookbook/qgis.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ In order for the [INSPIRE validator](https://inspire.ec.europa.eu/validator/home

## QGIS Desktop as a client for INSPIRE data

QGIS can act as a client for WMS, WMTS, WCS, CSW, Sensorthings API, OGC API Records and OGC API Features.
QGIS can act as a client for WMS, WFS, WCS, CSW, Sensorthings API and OGC API Features. A dedicated recipe about [adding data from data services to qgis](./ows-in-qgis.qmd) is available.

The QGIS data model is based on data layers and has minimalistic support for joins. QGIS is therefore less optimal for rich GML data as used in INSPIRE. There have been initiatives to bring hierarchical data to QGIS, such as [GMLAS](https://plugins.qgis.org/plugins/gml_application_schema_toolbox/) but adoption has been limited. The Application Schema functionality has been introduced in [GDAL/OGR](../utils/gdal.qmd), the QGIS plugin builds on top of it. OGR converts the contents of the GML to a relational database. Individual tables from that database are loaded in the QGIS interface.

0 comments on commit 6169716

Please sign in to comment.