Last active
April 12, 2018 06:07
-
-
Save Pessimistress/46702ea1813d4d06d1013db693c152f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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