Skip to content

BritishGeologicalSurvey/BGS-API-Documentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BGS Documentation

To make our data more FAIR, BGS have made a selection of our Open Data available as an API using the OGCAPI-Features standard at https://ogcapi.bgs.ac.uk/. This is targeted at academics, developers, data scientists & geospatial specialists who would like to work with our data programmatically using R/Python etc or would like a live connection to frequently updated datasets in their desktop GIS platform.

We would really appreciate your feedback or suggestions including what other data would benefit from this delivery mechanism.

The API is compatible with both ESRI ArcPro & QGIS allowing you a “live” link to the data – useful for those with frequent updates

OpenAPI specification is available through Swagger UI at - https://ogcapi.bgs.ac.uk/openapi?f=html

Data collections include:

For further documentations see OS which use the same protocol https://labs.os.uk/public/osngd/os-ngd-api-features/ https://labs.os.uk/public/osngd/os-ngd-api-features/code-playground/#template-leaflet https://labs.os.uk/public/osngd/os-ngd-api-features/examples/items.html#filter=bbox,datetime https://osngd.gitbook.io/osngd/accessing-os-ngd/access-the-os-ngd-api-features https://osdatahub.os.uk/docs/ofa/overview

Queries

Simple Queries

Limited to BBOX, Property Display/Filters & Sort.

Example to get:

CQL Queries

These allow full complex queries against those collections using a postgres backend.

Some example URL encoded queries:

Users don't have to URL encode the queries - the following will also work if copy & pasted into a browser: https://ogcapi.bgs.ac.uk/collections/recentearthquakes/items?f=json&limit=100&filter=ml BETWEEN 4 AND 4.5 AND depth > 5

Examples

In the notebook folder of this repository we have a few example Jupyter Notebooks showing how you can interact with our data.

Follow the instructions below to install and run the demonstration Jupyter Notebook on your own machine.

Prerequisites

  • Python 3
  • A Python 3 package manager e.g. pip3, conda

Installing dependencies

The following packages should be installed via pip3 or conda:

pip3 install -r requirements.txt

For developers

To test that the notebook runs to completion, extra packages are required:

pip3 install -r requirements-dev.txt

Run the test with:

pytest --nbval-lax notebooks\ogcapi-features-cql-owslib-earthquakes.ipynb

Starting the notebook

The demo runs in a Jupyter notebook. Start the notebook with:

jupyter notebook

A browser window will open at http://localhost:8888 with a list of available notebooks.

About

Documentation and examples for interacting with BGS OGCAPI-X endpoints

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 3

  •  
  •  
  •