Guest User

Untitled

a guest
Apr 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. function updateLayers(data) {
  2. const scatterplot = new deck.ScatterplotLayer({
  3. /* unique id of this layer */
  4. id: 'checkins',
  5. /* data: an array of objects */
  6. data,
  7. /* data accessors */
  8. getPosition: d => d.coordinates, // returns longitude, latitude, [altitude]
  9. getRadius: d => Math.sqrt(d.count), // returns radius in meters
  10. getColor: d => [255, 0, 0] // returns R, G, B, [A] in 0-255 range
  11. })
  12.  
  13. // Add the layer to deckgl:
  14. deckgl.setProps({layers: [ scatterplot ]});
  15. }
  16.  
  17. // Layers can be added, removed or updated at any time:
  18. updateLayers([
  19. {coordinates: [-122.402, 37.79], count: 412, address: '2nd & Market St'},
  20. // ...
  21. ]);
Add Comment
Please, Sign In to add comment