A web app for visualizing Geographic info using OGC-API standards using pygeoapi and OpenLayers
This is the result of a project for the Open Source GIS course during the Winter 2022 semester as part of the Geomatics MSc, run by the Karlsruhe University of Applied Sciences. The project as a whole aimed to explore the new features and possibilities offered by the new OGC API framework, a new standard based on OpenAPI which is succeeding the old OWS standard for geo APIs. The back-end was developed using pygeoapi, the front-end using the OpenLayers framework. Example data was obtained from an OWS service of Radiological Data hosted by the German Bundesamt fuer Strahlenschutz (BfS), which in turn was converted for hosting on our API using GDAL/OGR.
.
|-- index.html
|-- main.js
|-- package-lock.json
|-- package.json
|-- readme.md
|-- style.css
|-- vite.config.js
|-- media
|-- legend.jpeg
|-- logo.png
|-- logo2.png
|-- config
|-- configurations.js
Follow installation instructions of Back-end or Front-end as necessary
- Node.js
- Python 3
To host this project locally:
- Follow the "Install in 5 minutes" guide for pygeoapi, but don't change the
config-example.yml. Instead,download thegosolution-config.ymlfrom our github and drop it inside your pygeoapi folder. On the command control Navigate into the folderScribtand typeactivate!
Then the following:
set PYGEOAPI_OPENAPI= gosolution-openapi.yml
pygeoapi openapi generate $PYGEOAPI_CONFIG > $PYGEOAPI_OPENAPI
pygeoapi requires OGR to use data hosted from a WFS, so using this repository's gosolution-config.yml will cause an error without it.
-
Download the correct gdal wheel file for your specific version of python and operating system from Christoph Gohlke's website.
-
Navigate in console to the location of the wheel file from the previous step, and install with the following command:
python -m pip install path-to-wheel-file.whl- Launch the server.
pygeoapi serve- If you experience difficulty installing pygeoapi, there exist preconfigured virtual environments with pygeoapi already installed such as OSGeoLive or Docker which may be more accessible. Feel free to experiment.
To get the front end running pull the gosolutions-app folder from the repository. Then navigate on the comand controll of your computer into the folder and run npm start.
To display any other OGC API features, just change the variables in the configurations.js file.
IMPORTANT: The current implementation of this server with the resources provided requires the use of the CORS Plugin. This also requires setting the cors parameter to "true" in the config-example.yml file of pygeoapi.
The back end of this project can be edited in the config-example.yml of your pygeoapi installation. You can find the documentation of how to use that here
The front end of this project should work with any data hosted on an OGC API. Simply change the parameters found in config/configurations.js. The variable server_url refers to a server publishing with an OGC API up to the word "collections", and the variable collection refers to the name of the collection that you wish to display.
The initial concept of this project has remained largely unchanged since its inception: To explore the current possibilities of OGC API standards by rehosting (or relaying) publicly available OWS features and displaying them via OpenLayers. The scope and technologies used of the project have however undergone several revisions.
The initial, ambitious plan of the development team was to relay the data of a complete OWS server to an OpenLayers front end. This was quickly revised to provide a simple proof of concept through displaying one layer in OpenLayers. With the tech stack defined and the pipeline established, this project's ideal form would be a multi-featured demonstration of the capabilities of the OGC API.
This project was originally planned to be hosted using Geoserver, which has a community built OGC API Module which allows for the publishing of geodata in an OGC API compatible format. The Geoserver was installed on a virtual machine running OSGeoLive: A collection of geodata tools running on a Ubuntu platform maintained by OSGeo: The Open Source Geospatial Foundation.
OSGeoLive 14 ships with an older version of Geoserver which does not support the OGC API module, and so instead a Web Archive version of the latest nightly build Geoserver was directly launched on an Apache Tomcat server. The OGC API module was then installed on top of this version of Geoserver, which did correctly provide the relevant APIs. However, the nightly build of Geoserver (v2.23) contained a bug that prevents the use of a WFS as a data source. To overcome this, we downloaded a sample feature from the BfS in GeoJSON format, converted this to a Geopackage using QGIS desktop GIS software, and hosted this on the server, which worked for some time. Later on, new updates also broke the compatibility of Geoserver with the OGC API module, however, when all bugs have been resolved, the front end available in this repository should work with Geoserver-hosted OGC APIs, as well as any other OGC API for that matter.
Contributions are always welcome, please leave a pull request explaining any changes done, and one of the team members will respond as soon as possible.
This repository lacks front-end features, flexible styling, and would benefit from the integration of a way to handle a complex OWS service with multiple feature collections. The main.js and configurations.js files could be changed to allow for multiple custom collections and features to be displayed. Similarly, updates as more OGC API features become available for public use could be of benefit.
Bundesamt für Strahlenschutz for use of their Geoportal
- Monitors radiation in Germany
- Provides public geoportal with hourly updated data
- pygeoapi is licensed under an MIT License. This project provides an example of its implementation with modified parameters and no changes to the source code.
- OpenLayers is licensed under a BSD 2-Clause "Simplified" License.
- BfS data is licensed under the Ordinance on the determination of the terms of use for the provision of federal geodata (GeoNutzV), as well as Data License Germany - Attribution - Version 2.0.