This repository provides examples for querying, visualising, and mapping environmental monitoring data from the British Geological Survey (BGS) Sensor Data Service, published via an OGC SensorThings API-compliant FROST-Server endpoint (https://sensors.bgs.ac.uk/FROST-Server/v1.1/).
sensor-things-api-demo.ipynb — A Jupyter notebook demonstrating how to query the BGS SensorThings API endpoint with Python (requests), process time-series observations (pandas, numpy), filter outliers, and plot borehole sensor readings (matplotlib).web-maps/ — Standalone browser-based map examples built with Leaflet and OpenLayers showing live sensor locations and interactive time-series charts.You can view the interactive map examples directly in your browser via GitHub Pages or inspect their source code locally:
| Example | Description | Source Code | Live Demo |
|---|---|---|---|
| Leaflet Map | Displays BGS sensor locations using Leaflet and the STAM (SensorThings API Map) plugin. | web-maps/leaflet.html |
View Online |
| OpenLayers Map | Displays BGS sensor locations using OpenLayers and the STAM plugin. | web-maps/openlayers.html |
View Online |
| Federated Data Map | Created as part of the NERC EDS Amplify project. Combines live data from multiple SensorThings API endpoints (BGS Sensors and LinkedSystems) with marker clustering, location search, box zoom, and interactive Plotly time-series charts. | web-maps/federated.html |
View Online |
The files in web-maps/ are standalone HTML pages with no build step required. When editing them locally, serving them over a local HTTP server is recommended to avoid browser file:// CORS restrictions and to match how GitHub Pages serves the files:
Run the following command from the repository root:
python -m http.server 8000
Then open any of the maps in your browser (refreshing the page after saving changes):
web-maps/federated.html in the Explorer panel and select Open with Live Server.You can view the notebook and its outputs directly on GitHub, open a mobile-friendly version on Jupyter nbviewer, or run it locally on your machine.
:= assignment expression introduced in Python 3.8)pip or condaClone this repository:
git clone https://github.com/BritishGeologicalSurvey/sensor-things-api-demo.git
cd sensor-things-api-demo
(Optional) Create and activate a virtual environment:
python3 -m venv .venv
# On Linux/macOS:
source .venv/bin/activate
# On Windows (PowerShell):
.venv\Scripts\Activate.ps1
Install the required dependencies:
pip3 install -r requirements.txt
Launch Jupyter Notebook from the repository root:
jupyter notebook
A browser window will open at http://localhost:8888, where you can open sensor-things-api-demo.ipynb.
To verify that the notebook executes from start to finish without errors, install the development dependencies and run pytest with nbval:
pip3 install -r requirements.txt -r requirements_dev.txt
pytest --nbval-lax sensor-things-api-demo.ipynb
This project is released under the MIT License. Copyright (c) British Geological Survey.