geopython / pygeoapi

pygeoapi is a Python server implementation of the OGC API suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is open source and released under an MIT license.
https://pygeoapi.io
MIT License
460 stars 250 forks source link

Issue with Hateoas Provider #1610

Closed asifgis closed 3 months ago

asifgis commented 3 months ago

Description

earth-data:
        type: stac-collection
        title: OOC_Cubes_and_clouds
        id: OOC_Cubes_and_clouds
        description: Cubes and Clouds catalog for course submissions
        providers:
            - type: stac
              name: Hateoas
              data: https://esa.pages.eox.at/cubes-and-clouds-catalog/MOOC_Cubes_and_clouds
              file_types: catalog.json
        links: 
            -
earth-data-Not-working:
        type: stac-collection
        title: OOC_Cubes_and_clouds-not-working
        id: OOC_Cubes_and_clouds-not-working
        description: Cubes and Clouds catalog for course submissions not working
        providers:
            - type: stac
              name: Hateoas
              data: https://esa.pages.eox.at/cubes-and-clouds-catalog/MOOC_Cubes_and_clouds
              file_types: catalog.json            

Links in yaml configuration is mandatory. Please check the above examples one is working with links and other without links. Without links in the config generate the below error.

  File "d:\flask_app_geoapi\pygeoapi\.venv\lib\site-packages\flask\app.py", line 1488, in __call__
    return self.wsgi_app(environ, start_response)
  File "d:\flask_app_geoapi\pygeoapi\.venv\lib\site-packages\flask\app.py", line 1466, in wsgi_app
    response = self.handle_exception(e)
  File "d:\flask_app_geoapi\pygeoapi\.venv\lib\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
  File "d:\flask_app_geoapi\pygeoapi\.venv\lib\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "d:\flask_app_geoapi\pygeoapi\.venv\lib\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
  File "d:\flask_app_geoapi\pygeoapi\.venv\lib\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "D:\flask_app_geoapi\pygeoapi\pygeoapi\flask_app.py", line 482, in stac_catalog_path
    return get_response(api_.get_stac_path(request, path))
  File "D:\flask_app_geoapi\pygeoapi\pygeoapi\api.py", line 228, in inner
    headers, status, content = func(*args, **kwargs)
  File "D:\flask_app_geoapi\pygeoapi\pygeoapi\api.py", line 210, in inner
    return func(cls, req_out, *args[2:])
  File "D:\flask_app_geoapi\pygeoapi\pygeoapi\linked_data.py", line 60, in inner
    return func(*args, **kwargs)
  File "D:\flask_app_geoapi\pygeoapi\pygeoapi\api.py", line 3957, in get_stac_path
    content['links'].extend(stac_collections[dataset]['links'])
KeyError: 'links'

Steps to Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots/Tracebacks If applicable, add screenshots to help explain your problem.

Environment

Additional context Add any other context about the problem here.