Skip to content

Incorrect unit label returned for collections #2362

@webb-ben

Description

@webb-ben

Is your feature request related to a problem? Please describe.
pygeoapi currently exposes /parameters via a dictionary set on EDR providers .get_fields:

The fields for each parameter in this are currently:

     'type': # Required parameter data type,
     'title': # Required parameter
     'description': # Optional observed property description
     'x-ogc-unit': # Required unit symbol,
 

Which yields:
https://demo.pygeoapi.io/master/collections/icoads-sst?f=json

...
    "parameter_names":{
        "SST":{
            "id":"SST",
            "type":"Parameter",
            "observedProperty":{
                "label":{
                    "en":"SEA SURFACE TEMPERATURE"
                }
            },
            "unit":{
                "label":{
                    "en":"SEA SURFACE TEMPERATURE"
                },
                "symbol":{
                    "value":"Deg C",
                    "type":"http://www.opengis.net/def/uom/UCUM/"
                }
            }
        },
...

Describe the solution you'd like
I would like for there to be an additional optional field for the parameter unit which is used to populate the label instead of forwarding the observed property label. It is valid CovJSON even if we omit the unit label on cases where there is no returned unit label from the underlying provider.

Describe alternatives you've considered
We have implemented an ontology wrapper that adds QUDT unit information to the parameters (symbol, name, id) and aggregates parametes into groups. However this is not a solution for users who want to deploy with core pygeoapi.

An option could be for the providers to generate the entire Parameter object instead of a modified version from get_fields that is mapped into CovJSON parameters. The provider should be able to construct parameter JSON given that it is required to produce Parameters in the CovJSON data object. This could be an implemented behavior in the BaseEDR provider... https://github.com/internetofwater/pgedr/blob/main/src/pgedr/sql/__init__.py#L474-L494

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions