Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function updateLayers(data) {
- const scatterplot = new deck.ScatterplotLayer({
- /* unique id of this layer */
- id: 'checkins',
- /* data: an array of objects */
- data,
- /* data accessors */
- getPosition: d => d.coordinates, // returns longitude, latitude, [altitude]
- getRadius: d => Math.sqrt(d.count), // returns radius in meters
- getColor: d => [255, 0, 0] // returns R, G, B, [A] in 0-255 range
- })
- // Add the layer to deckgl:
- deckgl.setProps({layers: [ scatterplot ]});
- }
- // Layers can be added, removed or updated at any time:
- updateLayers([
- {coordinates: [-122.402, 37.79], count: 412, address: '2nd & Market St'},
- // ...
- ]);
Add Comment
Please, Sign In to add comment