pygeoapi icon indicating copy to clipboard operation
pygeoapi copied to clipboard

Fix Documentation for OGC API Coverages Formats

Open SpeckiJ opened this issue 6 months ago • 0 comments

Is your feature request related to a problem? Please describe.

There currently exists a hardcoded list of allowed FORMAT_TYPES every request is validated against. All requests with non-conforming formats are directly dropped as invalid by the API.

The Examples in the documentation for OGC API Coverages use different format types, i.e. application/x-grib2 or zarr, without any mention that those are not supported without prior modifications to the source-code.

There is a very small comment in this [commit] (https://github.com/geopython/pygeoapi/commit/d25d0cfa65d7e334ad7bdec2ef419a946aad3e62), that modifications to the source-code are necessary, but this is not easily findable and does not really offer guidance on how to fix the issue

Describe the solution you'd like

Either FORMAT_TYPES should be extendable by providers (every provider adds his own TYPES, or the documentation should include a large disclaimer that these examples are only exemplary and not functional. The current disclaimer:

The Rasterio provider format.name directive requires a valid GDAL raster driver short name.

is very misleading as it suggests that you can use any valid GDAL raster driver short name, when in fact you can not use a single one of these as none of them match FORMAT_TYPES

Describe alternatives you've considered

You can workaround the issue by serving a different mime_type when requesting a valid format, as demonstrated here (this passes validation as html is a valid type, but actually image/tiff is returned). But this is certainly not a clean solution and probably not compatible with most clients.

    providers:
      - type: coverage
        name: rasterio
        data: ./test.tif
        format:
          name: html
          mimetype: image/tiff

SpeckiJ avatar Jul 29 '24 12:07 SpeckiJ