diff --git a/config-gdp.yml b/config-gdp.yml index 6aee85278..4415ffe33 100644 --- a/config-gdp.yml +++ b/config-gdp.yml @@ -10,7 +10,7 @@ server: # First language is the default language - en-US - fr-CA - # cors: true + cors: true pretty_print: true limit: 10 # templates: @@ -73,38 +73,57 @@ metadata: role: pointOfContact resources: - PRISM: - description: - Parameter-elevation Regressions on Independent Slopes Model Monthly - Climate Data for the Continental United States. January 2012 Shapshot + nhgf-stac-collection: + type: stac-collection + title: NHGF STAC + description: SpatioTemporal Asset Catalog for the USGS Water Mission Area + links: + - type: application/json + rel: canonical + title: NHGF STAC Catalog + href: https://code.usgs.gov/wma/nhgf/stac/-/raw/main/catalog/catalog.json + hreflang: en-US extents: spatial: - bbox: - - -125.02083587646484 - - 24.10416603088379 - - -66.52082824707031 - - 49.937503814697266 + bbox: [-180, -90, 180, 90] crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84 - temporal: - begin: 1895-01-01 00:00:00+00:00 - end: 2013-02-01 00:00:00+00:00 - keywords: - - s3 - - usgs - - PRISM providers: - - data: s3://mdmf/gdp/PRISM.zarr - format: - mimetype: application/zip - name: zarr - name: xarray-edr - options: - s3: - anon: true - client_kwargs: - endpoint_url: https://usgs.osn.mghpcc.org/ - type: edr - x_field: lon - y_field: lat - title: PRISM - type: collection \ No newline at end of file + - type: stac + name: Hateoas + data: https://code.usgs.gov/wma/nhgf/stac/-/raw/main/catalog + file_types: catalog.json + # PRISM: + # description: + # Parameter-elevation Regressions on Independent Slopes Model Monthly + # Climate Data for the Continental United States. January 2012 Shapshot + # extents: + # spatial: + # bbox: + # - -125.02083587646484 + # - 24.10416603088379 + # - -66.52082824707031 + # - 49.937503814697266 + # crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84 + # temporal: + # begin: 1895-01-01 00:00:00+00:00 + # end: 2013-02-01 00:00:00+00:00 + # keywords: + # - s3 + # - usgs + # - PRISM + # providers: + # - data: s3://mdmf/gdp/PRISM.zarr + # format: + # mimetype: application/zip + # name: zarr + # name: xarray-edr + # options: + # s3: + # anon: true + # client_kwargs: + # endpoint_url: https://usgs.osn.mghpcc.org/ + # type: edr + # x_field: lon + # y_field: lat + # title: PRISM + # type: collection diff --git a/openai.yml b/openai.yml index 4d6b9f1f0..866efffa9 100644 --- a/openai.yml +++ b/openai.yml @@ -129,12 +129,6 @@ components: schema: $ref: '#/components/schemas/queryables' description: successful queryables operation - Tiles: - content: - application/json: - schema: - $ref: '#/components/schemas/tiles' - description: Retrieves the tiles description for this collection default: content: application/json: @@ -178,29 +172,6 @@ components: required: - queryables type: object - tilematrixsetlink: - properties: - tileMatrixSet: - type: string - tileMatrixSetURI: - type: string - required: - - tileMatrixSet - type: object - tiles: - properties: - links: - items: - $ref: https://schemas.opengis.net/ogcapi/tiles/part1/1.0/openapi/ogcapi-tiles-1.yaml#/components/schemas/link - type: array - tileMatrixSetLinks: - items: - $ref: '#/components/schemas/tilematrixsetlink' - type: array - required: - - tileMatrixSetLinks - - links - type: object info: contact: email: you@example.org @@ -253,70 +224,6 @@ paths: summary: Collections tags: - server - /collections/PRISM: - get: - description: Parameter-elevation Regressions on Independent Slopes Model Monthly - Climate Data for the Continental United States. January 2012 Shapshot - operationId: describePrismCollection - parameters: - - $ref: '#/components/parameters/f' - - $ref: '#/components/parameters/lang' - responses: - '200': - $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/Collection - '400': - $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter - '404': - $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/NotFound - '500': - $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError - summary: Get PRISM metadata - tags: - - PRISM - /collections/PRISM/cube: - get: - description: Parameter-elevation Regressions on Independent Slopes Model Monthly - Climate Data for the Continental United States. January 2012 Shapshot - operationId: queryCubePrism - parameters: - - $ref: https://schemas.opengis.net/ogcapi/edr/1.0/openapi/parameters/bbox.yaml - - $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/parameters/datetime - - $ref: https://schemas.opengis.net/ogcapi/edr/1.0/openapi/parameters/parameter-name.yaml - - $ref: https://schemas.opengis.net/ogcapi/edr/1.0/openapi/parameters/z.yaml - - $ref: '#/components/parameters/f' - responses: - '200': - content: - application/prs.coverage+json: - schema: - $ref: https://schemas.opengis.net/ogcapi/edr/1.0/openapi/schemas/coverageJSON.yaml - description: Response - summary: query Parameter-elevation Regressions on Independent Slopes Model Monthly - Climate Data for the Continental United States. January 2012 Shapshot by cube - tags: - - PRISM - /collections/PRISM/position: - get: - description: Parameter-elevation Regressions on Independent Slopes Model Monthly - Climate Data for the Continental United States. January 2012 Shapshot - operationId: queryPositionPrism - parameters: - - $ref: https://schemas.opengis.net/ogcapi/edr/1.0/openapi/parameters/positionCoords.yaml - - $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/parameters/datetime - - $ref: https://schemas.opengis.net/ogcapi/edr/1.0/openapi/parameters/parameter-name.yaml - - $ref: https://schemas.opengis.net/ogcapi/edr/1.0/openapi/parameters/z.yaml - - $ref: '#/components/parameters/f' - responses: - '200': - content: - application/prs.coverage+json: - schema: - $ref: https://schemas.opengis.net/ogcapi/edr/1.0/openapi/schemas/coverageJSON.yaml - description: Response - summary: query Parameter-elevation Regressions on Independent Slopes Model Monthly - Climate Data for the Continental United States. January 2012 Shapshot by position - tags: - - PRISM /conformance: get: description: API conformance definition @@ -432,6 +339,19 @@ paths: summary: This document tags: - server + /stac: + get: + description: SpatioTemporal Asset Catalog + operationId: getStacCatalog + parameters: [] + responses: + '200': + $ref: '#/components/responses/200' + default: + $ref: '#/components/responses/default' + summary: SpatioTemporal Asset Catalog + tags: + - stac servers: - description: pygeoapi provides an API to geospatial data url: http://localhost:5001 @@ -441,9 +361,6 @@ tags: description: information url: https://example.org name: server -- description: Parameter-elevation Regressions on Independent Slopes Model Monthly - Climate Data for the Continental United States. January 2012 Shapshot - name: PRISM - name: coverages - name: edr - name: records diff --git a/openapi.yml b/openapi.yml new file mode 100644 index 000000000..e7ba238dd --- /dev/null +++ b/openapi.yml @@ -0,0 +1,372 @@ +components: + parameters: + bbox: + description: Only features that have a geometry that intersects the bounding + box are selected.The bounding box is provided as four or six numbers, depending + on whether the coordinate reference system includes a vertical axis (height + or depth). + explode: false + in: query + name: bbox + required: false + schema: + items: + type: number + maxItems: 6 + minItems: 4 + type: array + style: form + bbox-crs: + description: Indicates the coordinate reference system for the given bbox coordinates. + explode: false + in: query + name: bbox-crs + required: false + schema: + format: uri + type: string + style: form + bbox-crs-epsg: + description: Indicates the EPSG for the given bbox coordinates. + explode: false + in: query + name: bbox-crs + required: false + schema: + default: 4326 + type: integer + style: form + crs: + description: Indicates the coordinate reference system for the results. + explode: false + in: query + name: crs + required: false + schema: + format: uri + type: string + style: form + f: + description: The optional f parameter indicates the output format which the + server shall provide as part of the response document. The default format + is GeoJSON. + explode: false + in: query + name: f + required: false + schema: + default: json + enum: + - json + - html + - jsonld + type: string + style: form + lang: + description: The optional lang parameter instructs the server return a response + in a certain language, if supported. If the language is not among the available + values, the Accept-Language header language will be used if it is supported. + If the header is missing, the default server language is used. Note that providers + may only support a single language (or often no language at all), that can + be different from the server language. Language strings can be written in + a complex (e.g. "fr-CA,fr;q=0.9,en-US;q=0.8,en;q=0.7"), simple (e.g. "de") + or locale-like (e.g. "de-CH" or "fr_BE") fashion. + in: query + name: lang + required: false + schema: + default: en-US + enum: + - en-US + - fr-CA + type: string + offset: + description: The optional offset parameter indicates the index within the result + set from which the server shall begin presenting results in the response document. The + first element has an index of 0 (default). + explode: false + in: query + name: offset + required: false + schema: + default: 0 + minimum: 0 + type: integer + style: form + resourceId: + description: Configuration resource identifier + in: path + name: resourceId + required: true + schema: + type: string + skipGeometry: + description: This option can be used to skip response geometries for each feature. + explode: false + in: query + name: skipGeometry + required: false + schema: + default: false + type: boolean + style: form + vendorSpecificParameters: + description: Additional "free-form" parameters that are not explicitly defined + in: query + name: vendorSpecificParameters + schema: + additionalProperties: true + type: object + style: form + responses: + '200': + description: successful operation + '204': + description: no content + Queryables: + content: + application/json: + schema: + $ref: '#/components/schemas/queryables' + description: successful queryables operation + default: + content: + application/json: + schema: + $ref: https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/exception.yaml + description: Unexpected error + schemas: + queryable: + properties: + description: + description: a human-readable narrative describing the queryable + type: string + language: + default: + - en + description: the language used for the title and description + type: string + queryable: + description: the token that may be used in a CQL predicate + type: string + title: + description: a human readable title for the queryable + type: string + type: + description: the data type of the queryable + type: string + type-ref: + description: a reference to the formal definition of the type + format: url + type: string + required: + - queryable + - type + type: object + queryables: + properties: + queryables: + items: + $ref: '#/components/schemas/queryable' + type: array + required: + - queryables + type: object +info: + contact: + email: you@example.org + name: Organization Name + url: https://pygeoapi.io + description: pygeoapi provides an API to geospatial data + license: + name: CC-BY 4.0 license + url: https://creativecommons.org/licenses/by/4.0/ + termsOfService: https://creativecommons.org/licenses/by/4.0/ + title: pygeoapi default instance + version: 0.19.dev0 + x-keywords: + - geospatial + - data + - api +openapi: 3.0.2 +paths: + /: + get: + description: Landing page + operationId: getLandingPage + parameters: + - $ref: '#/components/parameters/f' + - $ref: '#/components/parameters/lang' + responses: + '200': + $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/LandingPage + '400': + $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter + '500': + $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError + summary: Landing page + tags: + - server + /collections: + get: + description: Collections + operationId: getCollections + parameters: + - $ref: '#/components/parameters/f' + - $ref: '#/components/parameters/lang' + responses: + '200': + $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/LandingPage + '400': + $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter + '500': + $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError + summary: Collections + tags: + - server + /conformance: + get: + description: API conformance definition + operationId: getConformanceDeclaration + parameters: + - $ref: '#/components/parameters/f' + - $ref: '#/components/parameters/lang' + responses: + '200': + $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/LandingPage + '400': + $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter + '500': + $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError + summary: API conformance definition + tags: + - server + /jobs: + get: + description: Retrieve a list of jobs + operationId: getJobs + responses: + '200': + $ref: '#/components/responses/200' + '404': + $ref: https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/responses/NotFound.yaml + default: + $ref: '#/components/responses/default' + summary: Retrieve jobs list + tags: + - jobs + /jobs/{jobId}: + delete: + description: Cancel / delete job + operationId: deleteJob + parameters: + - &id001 + description: job identifier + in: path + name: jobId + required: true + schema: + type: string + responses: + '204': + $ref: '#/components/responses/204' + '404': + $ref: https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/responses/NotFound.yaml + default: + $ref: '#/components/responses/default' + summary: Cancel / delete job + tags: + - jobs + get: + description: Retrieve job details + operationId: getJob + parameters: + - *id001 + - $ref: '#/components/parameters/f' + responses: + '200': + $ref: '#/components/responses/200' + '404': + $ref: https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/responses/NotFound.yaml + default: + $ref: '#/components/responses/default' + summary: Retrieve job details + tags: + - jobs + /jobs/{jobId}/results: + get: + description: Retrieve job results + operationId: getJobResults + parameters: + - *id001 + - $ref: '#/components/parameters/f' + responses: + '200': + $ref: '#/components/responses/200' + '404': + $ref: https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/responses/NotFound.yaml + default: + $ref: '#/components/responses/default' + summary: Retrieve job results + tags: + - jobs + /openapi: + get: + description: This document + operationId: getOpenapi + parameters: + - $ref: '#/components/parameters/f' + - $ref: '#/components/parameters/lang' + - description: UI to render the OpenAPI document + explode: false + in: query + name: ui + required: false + schema: + default: swagger + enum: + - swagger + - redoc + type: string + style: form + responses: + '200': + $ref: '#/components/responses/200' + '400': + $ref: https://schemas.opengis.net\ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter + default: + $ref: '#/components/responses/default' + summary: This document + tags: + - server + /stac: + get: + description: SpatioTemporal Asset Catalog + operationId: getStacCatalog + parameters: [] + responses: + '200': + $ref: '#/components/responses/200' + default: + $ref: '#/components/responses/default' + summary: SpatioTemporal Asset Catalog + tags: + - stac +servers: +- description: pygeoapi provides an API to geospatial data + url: http://localhost:5002 +tags: +- description: pygeoapi provides an API to geospatial data + externalDocs: + description: information + url: https://example.org + name: server +- name: coverages +- name: edr +- name: records +- name: features +- name: maps +- name: processes +- name: jobs +- name: tiles +- name: stac diff --git a/pygeoapi/provider/hateoas.py b/pygeoapi/provider/hateoas.py index 0d3ec9876..2dc15285b 100644 --- a/pygeoapi/provider/hateoas.py +++ b/pygeoapi/provider/hateoas.py @@ -84,7 +84,7 @@ def get_data_path(self, baseurl, urlpath, entrypath): child_links.append({ 'rel': 'parent', 'href': parentpath, - 'type': 'text/html' + 'type': 'application/json' }) depth = entrypath.count('/') @@ -120,8 +120,9 @@ def get_data_path(self, baseurl, urlpath, entrypath): try: jsondata = _get_json_data(f'{data_path}/collection.json') resource_type = 'Collection' - content['license'] = jsondata['license'] - content['extent'] = jsondata['extent'] + for key in ['license', 'extent', 'id']: + if key in jsondata: + content[key] = jsondata[key] except Exception: try: filename = os.path.basename(data_path) @@ -150,7 +151,7 @@ def get_data_path(self, baseurl, urlpath, entrypath): child_links.append({ 'rel': 'child', 'href': newpath, - 'type': 'text/html', + 'type': 'application/json', 'created': "-", 'entry:type': 'Catalog' }) @@ -158,7 +159,7 @@ def get_data_path(self, baseurl, urlpath, entrypath): child_links.append({ 'rel': 'child', 'href': newpath, - 'type': 'text/html', + 'type': 'application/json', 'created': "-", 'entry:type': 'Collection' })