xarray-contrib / xdggs

Xarray extension for DGGS
Apache License 2.0
54 stars 9 forks source link

Plotting using lonboard #11

Open benbovy opened 10 months ago

benbovy commented 10 months ago

lonboard is a new tool for efficient and interactive plotting of (vector) geospatial data in Jupyter.

It would be nice to leverage it for plotting DGGS data.

Lonboard uses deck.gl in the front-end. Although this is not (yet) available in lonboard, Deck.gl has specific layers for H3 and S2 so for those two grids this could potentially be very efficient as we would only need to transfer cell ids and cell values (colors) to the front-end and let deck.gl compute and render the cells.

For the other grids, we could fallback to transfer the grid cell geometries as polygons (see #10) and use lonboard's SolidPolygonLayers.

cc @kylebarron

kylebarron commented 10 months ago

I think you probably want the H3HexagonLayer instead of the clustering variant. The main annoyance with the h3 layer is that h3-js doesn't support the uint64 representation of an h3 index, so you either have to transmit the data to JS as strings or convert the uint64 to a hex string once you get there. Are s2 tokens always strings?

Either way, they're relatively layers easy to wrap, at least putting off h3 integers for later

benbovy commented 10 months ago

The main annoyance with the h3 layer is that h3-js doesn't support the uint64 representation of an h3 index, so you either have to transmit the data to JS as strings or convert the uint64 to a hex string once you get there. Are s2 tokens always strings?

Yes I guess we'd have to do the same for converting s2 cell (uint64) ids to s2 tokens.