update providers to allow 1..n representations (#489)

This commit is contained in:
Tom Kralidis
2020-07-13 06:28:11 -04:00
committed by GitHub
parent 3938420dc2
commit 28157426f5
19 changed files with 714 additions and 559 deletions
+20 -8
View File
@@ -111,10 +111,20 @@ The ``metadata`` section provides settings for overall service metadata and desc
The ``resources`` section lists 1 or more dataset collections to be published by the server.
The ``resource.type`` property is required. Allowed types are:
- ``collection``
- ``process``
- ``stac-collection``
The ``providers`` block is a list of 1..n providers with which to operate the data on. Each
provider requires a ``type`` property. Allowed types are:
- ``feature``
A collection's default provider can be qualified with ``default: true`` in the provider
configuration. If ``default`` is not included, the first provider is assumed to be the
default.
.. code-block:: yaml
resources:
@@ -143,18 +153,20 @@ The ``resource.type`` property is required. Allowed types are:
temporal: # optional
begin: 2000-10-30T18:24:39Z # start datetime in RFC3339
end: 2007-10-30T08:57:29Z # end datetime in RFC3339
provider: # required connection information
providers: # list of 1..n required connections information
# provider name
# 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
name: CSV
data: tests/data/obs.csv # required: the data filesystem path or URL, depending on plugin setup
id_field: id # required for vector data, the field corresponding to the ID
time_field: datetimestamp # optional field corresponding to the temporal propert of the dataset
properties: # optional: only return the following properties, in order
- stn_id
- value
- type: feature # underlying data geospatial type: (allowed values are: feature)
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
id_field: id # required for vector data, the field corresponding to the ID
time_field: datetimestamp # optional field corresponding to the temporal propert of the dataset
properties: # optional: only return the following properties, in order
- stn_id
- value
hello-world: # name of process
type: collection # REQUIRED (collection, process, or stac-collection)
+48 -41
View File
@@ -35,13 +35,14 @@ definition.
.. code-block:: yaml
provider:
name: CSV
data: tests/data/obs.csv
id_field: id
geometry:
x_field: long
y_field: lat
providers:
- type: feature
name: CSV
data: tests/data/obs.csv
id_field: id
geometry:
x_field: long
y_field: lat
GeoJSON
@@ -51,10 +52,11 @@ To publish a GeoJSON file, the file must be a valid GeoJSON FeatureCollection.
.. code-block:: yaml
provider:
name: GeoJSON
data: tests/data/file.json
id_field: id
providers:
- type: feature
name: GeoJSON
data: tests/data/file.json
id_field: id
Elasticsearch
@@ -71,11 +73,12 @@ To publish an Elasticsearch index, the following are required in your index:
.. code-block:: yaml
provider:
name: Elasticsearch
data: http://localhost:9200/ne_110m_populated_places_simple
id_field: geonameid
time_field: datetimefield
providers:
- type: feature
name: Elasticsearch
data: http://localhost:9200/ne_110m_populated_places_simple
id_field: geonameid
time_field: datetimefield
OGR
^^^
@@ -89,10 +92,11 @@ MongoDB
.. code-block:: yaml
provider:
name: MongoDB
data: mongodb://localhost:27017/testdb
collection: testplaces
providers:
- type: feature
name: MongoDB
data: mongodb://localhost:27017/testdb
collection: testplaces
PostgreSQL
@@ -102,17 +106,18 @@ PostgreSQL
.. code-block:: yaml
provider:
name: PostgreSQL
data:
host: 127.0.0.1
dbname: test
user: postgres
password: postgres
search_path: [osm, public]
id_field: osm_id
table: hotosm_bdi_waterways
geom_field: foo_geom
providers:
- type: feature
name: PostgreSQL
data:
host: 127.0.0.1
dbname: test
user: postgres
password: postgres
search_path: [osm, public]
id_field: osm_id
table: hotosm_bdi_waterways
geom_field: foo_geom
SQLiteGPKG
@@ -124,22 +129,24 @@ SQLite file:
.. code-block:: yaml
provider:
name: SQLiteGPKG
data: ./tests/data/ne_110m_admin_0_countries.sqlite
id_field: ogc_fid
table: ne_110m_admin_0_countries
providers:
- type: feature
name: SQLiteGPKG
data: ./tests/data/ne_110m_admin_0_countries.sqlite
id_field: ogc_fid
table: ne_110m_admin_0_countries
GeoPackage file:
.. code-block:: yaml
provider:
name: SQLiteGPKG
data: ./tests/data/poi_portugal.gpkg
id_field: osm_id
table: poi_portugal
providers:
- type: feature
name: SQLiteGPKG
data: ./tests/data/poi_portugal.gpkg
id_field: osm_id
table: poi_portugal
Data access examples
+6 -5
View File
@@ -18,11 +18,12 @@ to the given directory and specifying allowed file types:
my-stac-resource:
type: stac-collection
...
provider:
name: FileSystem
data: /Users/tomkralidis/Dev/data/gdps
file_types:
- .grib2
providers:
- type: stac
name: FileSystem
data: /Users/tomkralidis/Dev/data/gdps
file_types:
- .grib2
.. note::
+10 -8
View File
@@ -111,10 +111,11 @@ The following methods are options to connect the plugin to pygeoapi:
.. code-block:: yaml
provider:
name: MyCoolData
data: /path/to/file
id_field: stn_id
providers:
- type: feature
name: MyCoolData
data: /path/to/file
id_field: stn_id
**Option 2**: implement outside of pygeoapi and add to configuration (recommended)
@@ -126,10 +127,11 @@ The following methods are options to connect the plugin to pygeoapi:
.. code-block:: yaml
provider:
name: mycooldatapackage.mycooldata.MyCoolDataProvider
data: /path/to/file
id_field: stn_id
providers:
- type: feature
name: mycooldatapackage.mycooldata.MyCoolDataProvider
data: /path/to/file
id_field: stn_id
Example: custom pygeoapi formatter
----------------------------------