Skip to content

Commit

Permalink
implement OGC EDR API (geopython#658)
Browse files Browse the repository at this point in the history
* implement OGC EDR API
* add docs/tests
* fix tests
  • Loading branch information
tomkralidis committed Mar 15, 2021
1 parent 5d82de5 commit b26280d
Show file tree
Hide file tree
Showing 21 changed files with 830 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ARG ADD_DEB_PACKAGES="python3-gdal python3-psycopg2 python3-xarray python3-scipy
ENV TZ=${TIMEZONE} \
DEBIAN_FRONTEND="noninteractive" \
DEB_BUILD_DEPS="software-properties-common curl unzip" \
DEB_PACKAGES="python3-pip python3-setuptools python3-distutils python3-yaml python3-dateutil python3-tz python3-flask python3-flask-cors python3-unicodecsv python3-click python3-greenlet python3-gevent python3-wheel gunicorn libsqlite3-mod-spatialite ${ADD_DEB_PACKAGES}"
DEB_PACKAGES="python3-pip python3-setuptools python3-distutils python3-shapely python3-yaml python3-dateutil python3-tz python3-flask python3-flask-cors python3-unicodecsv python3-click python3-greenlet python3-gevent python3-wheel gunicorn libsqlite3-mod-spatialite ${ADD_DEB_PACKAGES}"

RUN mkdir -p /pygeoapi/pygeoapi
# Add files required for pip/setuptools
Expand Down
2 changes: 1 addition & 1 deletion docs/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ default.
# see pygeoapi.plugin for supported providers
# for custom built plugins, use the import path (e.g. mypackage.provider.MyProvider)
# see Plugins section for more information
- type: feature # underlying data geospatial type: (allowed values are: feature, coverage, record, tile)
- type: feature # underlying data geospatial type: (allowed values are: feature, coverage, record, tile, edr)
default: true # optional: if not specified, the first provider definition is considered the default
name: CSV
data: tests/data/obs.csv # required: the data filesystem path or URL, depending on plugin setup
Expand Down
1 change: 1 addition & 0 deletions docs/source/data-publishing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ return back data to the pygeoapi API framework in a plug and play fashion.
ogcapi-tiles
ogcapi-processes
ogcapi-records
ogcapi-edr
stac
2 changes: 1 addition & 1 deletion docs/source/data-publishing/ogcapi-coverages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The `xarray`_ provider plugin reads and extracts `NetCDF`_ and `Zarr`_ data.
.. note::
`Zarr`_ files are directories with files and subdirectories. Therefore
a zip file is returned upon request for said format.
a zip file is returned upon request for said format.

Data access examples
--------------------
Expand Down
84 changes: 84 additions & 0 deletions docs/source/data-publishing/ogcapi-edr.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
.. _ogcapi-edr:

Publishing data to OGC API - Environmental Data Retrieval
=========================================================

The `OGC Environmental Data Retrieval (EDR) (API)`_ provides a family of
lightweight query interfaces to access spatio-temporal data resources.

To add spatio-temporal data to pygeoapi for EDR query interfaces, you
can use the dataset example in :ref:`configuration` as a baseline and
modify accordingly.

Providers
---------

pygeoapi core EDR providers are listed below, along with a matrix of supported query
parameters.

.. csv-table::
:header: Provider, coords, parameter-name, datetime
:align: left

xarray-edr,✅,✅,✅


Below are specific connection examples based on supported providers.

Connection examples
-------------------

xarray-edr
^^^^^^^^^^

The `xarray-edr`_ provider plugin reads and extracts `NetCDF`_ and `Zarr`_ data via `xarray`_.

.. code-block:: yaml
providers:
- type: edr
name: xarray-edr
data: tests/data/coads_sst.nc
# optionally specify x/y/time fields, else provider will attempt
# to derive automagically
x_field: lat
x_field: lon
time_field: time
format:
name: netcdf
mimetype: application/x-netcdf
providers:
- type: edr
name: xarray-edr
data: tests/data/analysed_sst.zarr
format:
name: zarr
mimetype: application/zip
.. note::

`Zarr`_ files are directories with files and subdirectories. Therefore
a zip file is returned upon request for said format.

Data access examples
--------------------

- list all collections
- http://localhost:5000/collections
- overview of dataset
- http://localhost:5000/collections/foo
- dataset position query
- http://localhost:5000/collections/foo/position?coords=POINT(-75%2045)
- dataset position query for a specific parameter
- http://localhost:5000/collections/foo/position?coords=POINT(-75%2045)&parameter-name=SST
- dataset position query for a specific parameter and time step
- http://localhost:5000/collections/foo/position?coords=POINT(-75%2045)&parameter-name=SST&datetime=2000-01-16


.. _`xarray`: https://xarray.pydata.org
.. _`NetCDF`: https://en.wikipedia.org/wiki/NetCDF
.. _`Zarr`: https://zarr.readthedocs.io/en/stable


.. _`OGC Environmental Data Retrieval (EDR) (API)`: https://github.com/opengeospatial/ogcapi-coverages
9 changes: 8 additions & 1 deletion docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ Features

- out of the box modern OGC API server
- certified OGC Compliant and Reference Implementation for OGC API - Features
- additionally implements OGC API - Coverages, OGC API - Tiles, OGC API - Processes, OGC API - Records and SpatioTemporal Asset Library
- additionally implements
- OGC API - Coverages
- OGC API - Tiles
- OGC API - Processes
- OGC API - Environmental Data Retrieval
- SpatioTemporal Asset Library
- out of the box data provider plugins for rasterio, GDAL/OGR, Elasticsearch, PostgreSQL/PostGIS
- easy to use OpenAPI / Swagger documentation for developers
- supports JSON, GeoJSON, HTML and CSV output
Expand Down Expand Up @@ -41,6 +46,7 @@ Standards are at the core of pygeoapi. Below is the project's standards support
`OGC API - Tiles`_,Implementing
`OGC API - Processes`_,Implementing
`OGC API - Records`_,Implementing
`OGC API - Environmental Data Retrieval`_,Implementing
`SpatioTemporal Asset Catalog`_,Implementing


Expand All @@ -51,4 +57,5 @@ Standards are at the core of pygeoapi. Below is the project's standards support
.. _`OGC API - Tiles`: https://github.com/opengeospatial/ogcapi-tiles
.. _`OGC API - Processes`: https://github.com/opengeospatial/ogcapi-processes
.. _`OGC API - Records`: https://github.com/opengeospatial/ogcapi-records
.. _`OGC API - Environmental Data Retrieval`: https://github.com/opengeospatial/ogcapi-environmental-data-retrieval
.. _`SpatioTemporal Asset Catalog`: https://stacspec.org
20 changes: 20 additions & 0 deletions docs/source/tour.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ This page provides metadata catalogue search capabilities
.. seealso::
:ref:`ogcapi-records` for more OGC API - Records request examples.


Processes
---------

Expand All @@ -160,6 +161,25 @@ The processes page provides a list of process integrated onto the server, along
:ref:`ogcapi-processes` for more OGC API - Processes request examples.


Environmental data retrieval
----------------------------

http://localhost:5000/collections/edr-test

This page provides, in addition to a common collection description, specific
link relations for EDR queries if the collection has an EDR capability, as
well as supported parameter names to select.

http://localhost:5000/collections/edr-test/position?coords=POINT(111 13)&parameter-name=SST&f=json

This page executes a position query against a given parameter name, providing
a response in CoverageJSON.


.. seealso::
:ref:`ogcapi-edr` for more OGC API - EDR request examples.


SpatioTemporal Assets
---------------------

Expand Down
26 changes: 26 additions & 0 deletions pygeoapi-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,32 @@ resources:
name: GRIB2
mimetype: application/x-grib2

icoads-sst:
type: collection
title: International Comprehensive Ocean-Atmosphere Data Set (ICOADS)
description: International Comprehensive Ocean-Atmosphere Data Set (ICOADS)
keywords:
- icoads
- sst
- air temperature
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
links:
- type: text/html
rel: canonical
title: information
href: https://psl.noaa.gov/data/gridded/data.coads.1deg.html
hreflang: en-US
providers:
- type: edr
name: xarray-edr
data: tests/data/coads_sst.nc
format:
name: NetCDF
mimetype: application/x-netcdf

test-data:
type: stac-collection
title: pygeoapi test data
Expand Down
Loading

0 comments on commit b26280d

Please sign in to comment.