geopython / pywps

PyWPS is an implementation of the Web Processing Service standard from the Open Geospatial Consortium. PyWPS is written in Python.
https://pywps.org
MIT License
176 stars 117 forks source link

fix invalid supported UOMs description #686

Closed fmigneault closed 12 months ago

fmigneault commented 1 year ago

Overview

Fix process description literal UOMs reporting duplicates of the first default UOM instead of all supported UOMs.

For example, passing uoms=['metre', 'feet'] to LiteralInput would cause it to report as follows in the WPS description. The default UOM would be repeated for as many supported UOMs that were passed to the input.

<LiteralData>
  <ows:DataType ows:reference="http://www.w3.org/TR/xmlschema-2/#float">float</ows:DataType>
  <UOMs>
    <Default>
      <ows:UOM ows:reference="">m/s²</ows:UOM>
    </Default>
    <Supported>
      <ows:UOM ows:reference="">metre</ows:UOM>
      <ows:UOM ows:reference="">metre</ows:UOM>  <!-- error should be 'feet' -->
    </Supported>
  </UOMs>
</LiteralData>

At the same time, this fixes the optional reference attribute accordingly if it was not provided explicitly, or could not be mapped to a known unit of OGC URN.

According to https://schemas.opengis.net/ows/1.1.0/owsDomainType.xsd the ows:UOM which depends on ows:DomainMetadataType shows <attribute ref="ows:reference" use="optional" />

But the previous check of UOM class caused it to check of OGCUNIT if not provided with an empty string. The corresponding if in the template were also not consistent about reporting reference.

Related Issue / Discussion

Required by https://github.com/crim-ca/weaver/pull/541 Required by https://github.com/crim-ca/weaver/issues/430 Fixes https://github.com/geopython/pywps/issues/685

Contribution Agreement

(as per https://github.com/geopython/pywps/blob/master/CONTRIBUTING.rst#contributions-and-licensing)

cehbrecht commented 12 months ago

@fmigneault with PR #687 the tests should work again. If you think this PR is ready I can merge it.

fmigneault commented 12 months ago

@cehbrecht Can you consider this fix into 4.6.0 release?

fmigneault commented 12 months ago

On my side, the tests were running, but you can combine them with the other PR to validate they work together. Thanks!