Publishing metadata to OGC API - Records
OGC API - Records provides geospatial data access functionality to vector data.
To add vector data to pygeoapi, you can use the dataset example in Configuration as a baseline and modify accordingly.
Providers
pygeoapi core record providers are listed below, along with a matrix of supported query parameters.
Provider |
properties (filters) |
resulttype |
q |
bbox |
datetime |
sortby |
properties (display) |
CQL |
transactions |
---|---|---|---|---|---|---|---|---|---|
✅ |
results/hits |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
|
✅ |
results/hits |
✅ |
✅ |
✅ |
✅ |
❌ |
✅ |
✅ |
|
✅ |
results/hits |
✅ |
✅ |
✅ |
❌ |
❌ |
❌ |
❌ |
Below are specific connection examples based on supported providers.
Connection examples
ElasticsearchCatalogue
Note
Requires Python packages elasticsearch and elasticsearch-dsl
Note
Elasticsearch 8 or greater is supported.
To publish an Elasticsearch index, the following are required in your index:
indexes must be documents of valid OGC API - Records GeoJSON Features
index mappings must define the GeoJSON
geometry
as ageo_shape
providers:
- type: record
name: ElasticsearchCatalogue
data: http://localhost:9200/some_metadata_index
id_field: identifier
time_field: datetimefield
The ES provider also has the support for the CQL queries as indicated in the table above.
See also
CQL support for more details on how to use Common Query Language (CQL) to filter the collection with specific queries.
TinyDBCatalogue
Note
Requires Python package tinydb
To publish a TinyDB index, the following are required in your index:
indexes must be documents of valid OGC API - Records GeoJSON Features
providers:
- type: record
editable: true|false # optional, default is false
name: TinyDBCatalogue
data: /path/to/file.db
id_field: identifier
time_field: datetimefield
CSWFacade
Note
Requires Python package OWSLib
To publish a CSW using pygeoapi, the CSW base URL (data) is required. Note that the CSW Record core model is supported as a baseline.
providers:
- type: record
name: CSWFacade
data: https://demo.pycsw.org/cite/csw
id_field: identifier
time_field: datetime
title_field: title
Metadata search examples
overview of record collection * http://localhost:5000/collections/metadata-records
queryables * http://localhost:5000/collections/foo/queryables
browse records * http://localhost:5000/collections/foo/items
paging * http://localhost:5000/collections/foo/items?offset=10&limit=10
CSV outputs * http://localhost:5000/collections/foo/items?f=csv
query records (spatial) * http://localhost:5000/collections/foo/items?bbox=-180,-90,180,90
query records (attribute) * http://localhost:5000/collections/foo/items?propertyname=foo
query records (temporal) * http://localhost:5000/collections/my-metadata/items?datetime=2020-04-10T14:11:00Z
query features (temporal) and sort ascending by a property (if no +/- indicated, + is assumed) * http://localhost:5000/collections/my-metadata/items?datetime=2020-04-10T14:11:00Z&sortby=datetime
query features (temporal) and sort descending by a property * http://localhost:5000/collections/my-metadata/items?datetime=2020-04-10T14:11:00Z&sortby=-datetime
fetch a specific record * http://localhost:5000/collections/my-metadata/items/123
Note
provider id_field values support slashes (i.e. my/cool/identifier
). The client request would then
be responsible for encoding the identifier accordingly (i.e. http://localhost:5000/collections/my-metadata/items/my%2Fcool%2Fidentifier
)