From 43b44574f5146d81200398afcc0ebe687c8a716e Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Wed, 21 Mar 2018 09:18:59 -0400 Subject: [PATCH] update config, add conformance --- pygeoapi-config.yml | 15 +++++++++------ pygeoapi/flask_app.py | 2 +- pygeoapi/templates/service.html | 4 ++-- pygeoapi/views.py | 20 +++++++++++++++++++- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/pygeoapi-config.yml b/pygeoapi-config.yml index 4de655a..28a734d 100644 --- a/pygeoapi-config.yml +++ b/pygeoapi-config.yml @@ -15,14 +15,16 @@ logging: metadata: identification: title: pygeoapi - abstract: pygeoapi provides an API to geospatial data + description: pygeoapi provides an API to geospatial data keywords: - geospatial - data - api keywords_type: theme - fees: None - accessconstraints: None + terms_of_service: None + license: + name: CC-BY 4.0 license + url: https://creativecommons.org/licenses/by/4.0/ provider: name: Organization Name url: https://github.com/geopython/pygeoapi @@ -48,7 +50,7 @@ datasets: provider: CSV id_field: id title: Observations - abstract: Observations + description: Observations keywords: - observations - monitoring @@ -66,12 +68,13 @@ datasets: begin: 2000-10-30T18:24:39Z end: 2007-10-30T08:57:29Z data: tests/data/obs.csv + landsat-aws: type: Polygon provider: Elasticsearch id_field: id_ title: my dataset - abstract: my dataset + description: my dataset keywords: - kw1 - kw2 @@ -94,7 +97,7 @@ datasets: provider: GeoJSON id_field: null # null indicates use feature enumeration title: Large Lakes - abstract: lakes of the world, public domain + description: lakes of the world, public domain keywords: - lakes crs: diff --git a/pygeoapi/flask_app.py b/pygeoapi/flask_app.py index 8ace2b2..0f57259 100644 --- a/pygeoapi/flask_app.py +++ b/pygeoapi/flask_app.py @@ -57,7 +57,7 @@ def serve(ctx, host, port, debug=False): hostport = '{}:{}'.format(host_, port_) api = app.add_api(settings['swagger'], debug=debug, strict_validation=True, - arguments={'host': hostport}) + arguments={'host': hostport, 'config': settings}) settings['api'] = api.specification diff --git a/pygeoapi/templates/service.html b/pygeoapi/templates/service.html index 89cc7e4..a0a60f3 100644 --- a/pygeoapi/templates/service.html +++ b/pygeoapi/templates/service.html @@ -17,7 +17,7 @@

{{ config['metadata']['identification']['title'] }}

- {{ config['metadata']['identification']['abstract'] }} + {{ config['metadata']['identification']['description'] }}

Service Metadata

@@ -37,4 +37,4 @@
- \ No newline at end of file + diff --git a/pygeoapi/views.py b/pygeoapi/views.py index b9494c6..8a288e6 100644 --- a/pygeoapi/views.py +++ b/pygeoapi/views.py @@ -39,6 +39,24 @@ from pygeoapi.provider import load_provider LOGGER = logging.getLogger(__name__) +def api_conformance(f='json'): + """ + Provide conformance definition + + :param f: response format (default JSON) + + :returns: dict of conformance + """ + + return { + 'conformsTo': [ + 'http://www.opengis.net/spec/wfs-1/3.0/req/core', + 'http://www.opengis.net/spec/wfs-1/3.0/req/oas30', + 'http://www.opengis.net/spec/wfs-1/3.0/req/html', + 'http://www.opengis.net/spec/wfs-1/3.0/req/geojson' + ] + } + def describe_collections(f='json'): """ Provide feature collection metadata @@ -92,7 +110,7 @@ def describe_collections(f='json'): collection = {'links': [], 'crs': []} collection['name'] = k collection['title'] = v['title'] - collection['description'] = v['abstract'] + collection['description'] = v['description'] for crs in v['crs']: collection['crs'].append( 'http://www.opengis.net/def/crs/OGC/1.3/{}'.format(crs))