Skip to content

Instantly share code, notes, and snippets.

@Pessimistress
Last active April 12, 2018 06:07
Show Gist options
  • Save Pessimistress/46702ea1813d4d06d1013db693c152f6 to your computer and use it in GitHub Desktop.
Save Pessimistress/46702ea1813d4d06d1013db693c152f6 to your computer and use it in GitHub Desktop.
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'},
// ...
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment