Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transform-deck.gl #1

Open
kylebarron opened this issue Apr 11, 2020 · 1 comment
Open

transform-deck.gl #1

kylebarron opened this issue Apr 11, 2020 · 1 comment

Comments

@kylebarron
Copy link

Hello!

I'm interested in adding a new transform, specifically for https://deck.gl, an open source high performance geospatial rendering engine.

We have a Python binding, pydeck, that works in Jupyter notebook and lab through the ipywidget interface, but I'd like to enable it within the nteract ecosystem as well.

Aside from using a widget, Deck.gl has a JSON serialization interface, which encapsulates all the information we need to render a map, e.g.:

{
  "initialViewState": {
    "bearing": -27.36,
    "latitude": 52.2323,
    "longitude": -1.415,
    "maxZoom": 15,
    "minZoom": 5,
    "pitch": 40.5,
    "zoom": 6
  },
  "layers": [
    {
      "@@type": "HexagonLayer",
      "autoHighlight": true,
      "coverage": 1,
      "data": "https://raw.githubusercontent.com/uber-common/deck.gl-data/master/examples/3d-heatmap/heatmap-data.csv",
      "elevationRange": [0, 3000],
      "elevationScale": 50,
      "extruded": true,
      "getPosition": "@@=[lng, lat]",
      "id": "2655e643-8abb-41a2-99f7-cd79c0e41aea",
      "pickable": true
    }
  ],
  "mapStyle": "mapbox://styles/mapbox/dark-v9",
  "views": [{ "@@type": "MapView", "controller": true }]
}

This is easily generated by Pydeck, and on the JS side, it's very easy to consume (docs). Pseudocode:

import Deck from 'deck.gl'
import {JSONConverter} from '@deck.gl/json';

const deck = new Deck({
  canvas: 'deck-canvas',
  json
});

deck.setProps(jsonConverter.convert(json));

Deck.gl is react-based but with an optional js imperative API, so I think there's a simple way to do the above using React but haven't researched it yet.

So my proposal is to add a transform to consume Deck.gl JSON and render it with the Deck.gl JS library.

Would such a PR be accepted?

@captainsafia
Copy link
Member

Yes, a PR for this is welcome.

The docs have a section on creating transforms and the existing transforms are good examples to look at it.

Feel free to ping on Slack for help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants