opendatacube / datacube-wps

Web Processing Service running on opendatacube
Other
7 stars 3 forks source link

Terria integration slightly broken #135

Open benjimin opened 2 years ago

benjimin commented 2 years ago

Apparently TerriaJS is not integrating properly with this PyWPS app. Basic functionality still works, but upon processing completion the UI continues to display the text "Job is finished, downloading results..." (even after the results have been displayed) and "Error upserting model JSON" is raised inside the browser console.

Probably an upstream issue, but reportedly can be bypassed by omitting the complexOutput.

h/t @gtgrp-user for reporting (by slack and https://github.com/TerriaJS/terriajs/discussions/5942 discussion).

benjimin commented 2 years ago

The local (terria-cube) configuration of Terria is pretty straightforward: just specify type: wps, the url for the WPS, and the identifier for a particular process therein. (There is also some free-form labelling such as a name, anchor id, and description.)

The rest seems to be handled by TerriaJS: the wps type is the archetype example of their "catalog function" component, which produces a different "catalog item" (visible in the "now viewing / workbench" pane) for each processing request. I'm guessing this code loops over each individual output returned by the WPS request, and can handle an SVG link (which it formats as a thumbnail image) or an HTML link (which it formats as hyperlinked text), but crashes when it encounters raw time-series data embedded as JSON?

This architecture seems intended to handle any WPS generically, which is convenient up to a point but may make it difficult to deprecate server-side SVG output (#128) or perform arbitrary UI customisations (#126).

(Aside, if we configured terria-cube with the wps-getcapabilities "catalog group" then it would populate the browsable catalogue with different processes automatically.)

benjimin commented 2 years ago

For debugging, confirmed that stripping the ComplexOutput from the PyWPS process outputs list (e.g. 545f00860cfe4) does bypass the Terria problem, letting it draw the geometry onto the map and update (truncate) the message to "Job is finished". If there is a ComplexOutput then Terria does not display any representation of the WPS request geometry.

image

nf-s commented 2 years ago

Hi @benjimin

ODC-WPS is returning Terria catalog models in the old version 7 format. We try to automatically upgrade it to version 8, but there seems to be an issue here:

https://github.com/TerriaJS/terriajs/blob/80737c16a4d7e8fe0616f292bd24d599664a1ea8/lib/Models/Catalog/Ows/WebProcessingServiceCatalogFunctionJob.ts#L416-L434

nf-s commented 2 years ago

Hi @benjimin

I have a PR which seems to fix the issue. I have added a forceConvertResultsToV8 property which is set to true for your WPS processes. So when this PR is merged you will need to add this property to https://github.com/GeoscienceAustralia/dea-config/blob/master/dev/terria/terria-cube-v8.json

Link to test: http://ci.terria.io/wps-v7-fix/#clean&https://gist.githubusercontent.com/nf-s/b4891446b77102dcd5aac4c4911b2bfa/raw/75ed2688c38bd836691c0967d9f2d6a5d06cfb7d/terria-cube-wps.json

Please let me know if this fixes your problem Thanks!

benjimin commented 2 years ago

@nf-s are there any docs for the v7 and v8 format specs?

nf-s commented 2 years ago

We have a v7 to v8 migration guide here - https://docs.terria.io/guide/contributing/migration-guide/

Other docs can be found here https://docs.terria.io/guide/

For example - CSV catalog item format - https://docs.terria.io/guide/connecting-to-data/catalog-type-details/csv/