Skip to content

Instantly share code, notes, and snippets.

View ibgreen's full-sized avatar

Ib Green ibgreen

  • Foursquare
  • Miami
  • X @foursquare
View GitHub Profile
@ibgreen
ibgreen / app.js
Created May 21, 2018 19:52
deck.gl Pure JS App
import {Deck, MapController} from '@deck.gl/core';
import {GeoJsonLayer} from '@deck.gl/core-layers';
// source: Natural Earth http://www.naturalearthdata.com/ via geojson.xyz
const GEOJSON =
'https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_admin_1_states_provinces_shp.geojson'; //eslint-disable-line
const INITIAL_VIEW_STATE = {
latitude: 40,
longitude: -100,
@ibgreen
ibgreen / gist:8d9aca1cd9cfe537cc6bd85101652202
Created May 11, 2018 01:15
deck.gl child component auto positioning
import DeckGL, {MapView, FirstPersonView} from 'deck.gl';
// Multiple views and an auto-positioned base map
const views = [
new FirstPersonView({...}),
new MapView({id: 'basemap', ...})
];
render() {
return (
<DeckGL
@ibgreen
ibgreen / gist:454a4ff08bcde81bb6269f8f9b81ee6c
Last active May 11, 2018 01:13
deck.gl data auto-loading
// Pass URL directly as data, no need to load it first
const deck = new Deck({
...
layers: [
new ScatterplotLayer({
data: 'https://...'
})
]
});
const deck = new Deck({
...
initialViewState: {longitude: ..., latitude: ..., zoom: ...}
});
// or, if using React
<DeckGL initialViewState={{longitude: , latitude: , zoom: }} .../>
const deck = new Deck({width: '100%', height: '100%, ...'})
// or, if using react
<DeckGL width="100%" height="100%" .../>