TerriaJS / terriajs

A library for building rich, web-based geospatial data platforms.
https://terria.io
Apache License 2.0
1.14k stars 355 forks source link

TerriaJS and ERDDAP charting #2374

Open rsignell-usgs opened 7 years ago

rsignell-usgs commented 7 years ago

@terriajs, have you guys heard of ERDDAP? It provides RESTful services for delivering geospatial/temporal data that are uniformly spaced grids or tables (e.g. spreadsheet). It's used by over 50 organizations and is growing in popularity because both researchers and developers find it super easy and useful. Here's a few examples:

Web form from which you can build up an example Restful query: http://www.neracoos.org/erddap/tabledap/B01_accelerometer_all.html

Simple RESTful request: http://www.neracoos.org/erddap/tabledap/B01_accelerometer_all.htmlTable?significant_wave_height,time&time%3E=2017-02-07T11:37:14Z

Same request but with JSON payload: http://www.neracoos.org/erddap/tabledap/B01_accelerometer_all.json?significant_wave_height,time&time%3E=2017-02-07T11:37:14Z

I was wondering how hard it would be to show time series locations on a map in TerriaJS, and then when click point, be able to make time series plots via the charting interface

kring commented 7 years ago

Looks like it can also provide CSV: http://www.neracoos.org/erddap/tabledap/B01_accelerometer_all.csv?significant_wave_height,time&time%3E=2017-02-07T11:37:14Z

I thought it would be possible to just use such URLs directly in TerriaJS, but there are a few problems:

So with those two workarounds, TerriaJS will show a nice chart. If you add a latitude, longitude, and id (just set id to 1) column, it will also show a point on the map and a small chart in the feature info when you click it.

We could also present that web form right in TerriaJS by hooking into our CatalogFunction system. So the user would click an item in the catalog, see a form similar to the one in the first link above, and when they click "Run Analysis" they'd see a chart appear in the workbench. I don't think it would be a huge amount of work; a couple of days maybe.

kring commented 7 years ago

To see what I mean by CatalogFunction, visit this URL http://nationalmap.gov.au/#build/TerriaJS/test/init/wps.json and look at the items in the catalog under "Web Processing Service (WPS)". Those are all catalog functions.

rsignell-usgs commented 7 years ago

@kring, it's exciting to think that enabling ERDDAP charts with interaction might only take a few days work!

I tried the WPS "Extract Time-Series data", as that sounded the closest to the ERDDAP time-series extraction use case, and after some trial and error on the time and space extents of the data (helped out by doc discovered here: https://data.csiro.au/dap/landingpage?pid=csiro:6616&v=7&d=true) I eventually got a query that worked: http://nationalmap.gov.au/#share=s-tNrvpBiAXpHfzdNF5NxMnoDRELJ

But although I got a CSV of time series data delivered in a zip file I couldn't figure out how to display it on a chart. Am I missing something, or is that just not enabled for this dataset?

2017-02-15_13-34-42 2017-02-15_13-27-38

kring commented 7 years ago

Yeah it seems that particular WPS doesn't get turned into a chart. Try some of the others, like Annual Waverose. Click a point in the ocean near Australia (between the mainland and Tasmania for example), leave the other parameters blank, and hit run. You should see something like this: image That chart is generated by the server, not TerriaJS, but a WPS service can return any TerriaJS catalog item, and then it is added to the workbench. So maps and charts are both potential outputs of a WPS service.

rsignell-usgs commented 7 years ago

I guess we could go that route with ERDDAP, since ERDAP can create plots via a RESTful interface, but I was thinking that we would return the data as JSON or CSV and then use JS/TerriaJS charting for the time series data, so we could hover on chart to see values, etc.