diff --git a/pygeoapi/api.py b/pygeoapi/api.py index a5fdf38..d3c22c3 100644 --- a/pygeoapi/api.py +++ b/pygeoapi/api.py @@ -493,13 +493,13 @@ class API(object): 'type': 'application/geo+json', 'rel': 'self', 'title': 'This document as GeoJSON', - 'href': '{}/collections/{}/items'.format( + 'href': '{}/collections/{}/items?f=json'.format( self.config['server']['url'], dataset) }, { 'type': 'text/html', 'rel': 'alternate', 'title': 'This document as HTML', - 'href': '{}/collections/{}/items'.format( + 'href': '{}/collections/{}/items?f=html'.format( self.config['server']['url'], dataset) }, { 'type': 'application/geo+json', diff --git a/pygeoapi/flask_app.py b/pygeoapi/flask_app.py index 8f21425..703328b 100644 --- a/pygeoapi/flask_app.py +++ b/pygeoapi/flask_app.py @@ -46,7 +46,7 @@ if 'PYGEOAPI_CONFIG' not in os.environ: raise RuntimeError('PYGEOAPI_CONFIG environment variable not set') with open(os.environ.get('PYGEOAPI_CONFIG')) as fh: - CONFIG = yaml.load(fh) + CONFIG = yaml.load(fh, Loader=yaml.FullLoader) # CORS: optionally enable from config. if CONFIG['server'].get('cors', False): @@ -73,7 +73,7 @@ def root(): @APP.route('/api') def api(): with open(os.environ.get('PYGEOAPI_OPENAPI')) as ff: - openapi = yaml.load(ff) + openapi = yaml.load(ff, Loader=yaml.FullLoader) headers, status_code, content = api_.api(request.headers, request.args, openapi) diff --git a/pygeoapi/openapi.py b/pygeoapi/openapi.py index d90971e..4085307 100644 --- a/pygeoapi/openapi.py +++ b/pygeoapi/openapi.py @@ -184,6 +184,8 @@ def get_oas_30(cfg): 'tags': [k], 'parameters': [ {'$ref': '#/components/parameters/f'}, + {'$ref': '#/components/parameters/bbox'}, + {'$ref': '#/components/parameters/time'}, {'$ref': '#/components/parameters/limit'}, {'$ref': '#/components/parameters/sortby'}, {'$ref': '#/components/parameters/startindex'} @@ -217,6 +219,11 @@ def get_oas_30(cfg): 'type': 'number', 'format': 'float' } + elif v2['type'] == 'long': + schema = { + 'type': 'integer', + 'format': 'int64' + } else: schema = { 'type': v2['type'] @@ -231,7 +238,7 @@ def get_oas_30(cfg): 'explode': False }) - paths['{}/items/{{id}}'.format(collection_name_path)] = { + paths['{}/items/{{featureId}}'.format(collection_name_path)] = { 'get': { 'summary': 'Get {} feature by id'.format(v['title']), 'description': v['description'], @@ -374,6 +381,33 @@ def get_oas_30(cfg): 'style': 'form', 'explode': False }, + 'bbox': { + 'name': 'bbox', + 'in': 'query', + 'description': 'The bbox parameter indicates the minimum bounding rectangle upon which to query the collection in WFS84 (minx, miny, maxx, maxy).', # noqa + 'required': False, + 'schema': { + 'type': 'array', + 'minItems': 4, + 'maxItems': 6, + 'items': { + 'type': 'number' + } + }, + 'style': 'form', + 'explode': False + }, + 'datetime': { + 'name': 'datetime', + 'in': 'query', + 'description': 'The time parameter indicates an RFC3339 formatted datetime (single, interval, open).', # noqa + 'required': False, + 'schema': { + 'type': 'string' + }, + 'style': 'form', + 'explode': False, + }, 'limit': { 'name': 'limit', 'in': 'query', @@ -443,5 +477,5 @@ def generate_openapi_document(ctx, config_file): if config_file is None: raise click.ClickException('--config/-c required') with open(config_file) as ff: - s = yaml.load(ff) + s = yaml.load(ff, Loader=yaml.FullLoader) click.echo(yaml.safe_dump(get_oas(s), default_flow_style=False)) diff --git a/pygeoapi/provider/elasticsearch_.py b/pygeoapi/provider/elasticsearch_.py index d2a80ff..83371f3 100644 --- a/pygeoapi/provider/elasticsearch_.py +++ b/pygeoapi/provider/elasticsearch_.py @@ -238,7 +238,8 @@ class ElasticsearchProvider(BaseProvider): next(gen) except StopIteration: break - results['hits']['total'] = len(results['hits']['hits']) + results['hits']['total'] = \ + len(results['hits']['hits']) + startindex else: results = self.es.search(index=self.index_name, from_=startindex, size=limit, diff --git a/pygeoapi/templates/item.html b/pygeoapi/templates/item.html index 2d646cc..ebeae9d 100644 --- a/pygeoapi/templates/item.html +++ b/pygeoapi/templates/item.html @@ -79,7 +79,7 @@