Free AI web copilot to create summaries, insights and extended knowledge, download it at here
2916
Abstract
">;</span></pre></div><p id="f532">You can find the full documentation of the DeckGL class <a href="https://uber.github.io/deck.gl/index.html#/documentation/deckgl-api-reference/standalone/deckgl">here</a>. The scripting API extends the core Deck class with some additional features such as Mapbox integration.</p><p id="0f34">As a start, you may want to tweak these props to your own scenario:</p><ul><li><b>container</b>
The container in which deck.gl should append its canvas. Can be either a HTMLDivElement or the element id. Default to document.body. The deck.gl canvas is resized to fill the container.</li><li><b>longitude
latitude
zoom
pitch
bearing</b>
The initial view states of a geospatial visualization.</li><li><b>controller</b>
By default, the Deck canvas is fully interactive — you can zoom, rotate and pan around. Set <b>controller</b> to <i>false</i> to disable interaction.</li><li><b>map
mapStyle
mapboxApiAccessToken</b>
The scripting API offers out-of-the-box integration with Mapbox. To add a base map to your visualization, you need to include the Mapbox library and stylesheet. To disable the base map, simply exclude the mapbox script or set <b>map</b> to <i>false</i>.
Specify your map style and access token as props when initiating the Deck object. See <a href="https://www.mapbox.com/mapbox-gl-js/api/">Mapbox GL JS</a> documentation for how to use Mapbox.</li></ul><h2 id="86d2">Layers</h2><p id="ee12">Layers are pre-packaged WebGL visualizers for your data. You can quickly get impressive visual results through composition of multiple layers. Leveraging the GPU, deck.gl is able to render millions of data points in the browser smoothly. Suppose we have an array of objects <b>{coordinates, count, address}</b> describing geolocations where users checkin to a service. Here is a layer that renders a scatterplot from the data, each circle sized to reflect the prominence of the location:</p>
<figure id="dace">
<div>
<div>
<iframe class="gist-iframe" src="/gist/Pessimistress/46702ea1813d4d06d1013db693c152f6.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><p id="d009">Here is an example of updating a layer based on user-provided parameters:</p><figure id="3ba5"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*NH_hbdrL7LAqlqlSxv6CNA.png"><figcaption>Play with this example on <a href="https://codepen.io/vis-gl/pen/NYYeNj">Codepen</a> | <a href="https://beta.observablehq.com/@pessimistress/deck-gl-hexagonlayer-example">Observable</a></figcaption></figure><p id="a829">The best way to explore the extensive deck.gl layer collection is the interactive documentation in <a href="https://uber.github.io/deck.gl/index.html#/documentation/deckgl-api-reference/layers/layer">our laye
Options
r catalog</a>.</p><h2 id="68a7">Interactions</h2><p id="b65f">deck.gl makes it easy to interact with objects rendered in the 3d scene. To make a layer interactive, turn on the <b>pickable</b> prop:</p>
<figure id="db0f">
<div>
<div>
<iframe class="gist-iframe" src="/gist/Pessimistress/1fd054d5422ab3fe7b66429b50111d13.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><p id="e894">Aside from per-layer interaction, you may also listen to user events on the entire <b>DeckGL</b> canvas. Some useful <b>DeckGL</b> callback props are:</p><ul><li><b>onLayerClick</b>
called when any layer is clicked</li><li><b>onLayerHover</b>
called when any layer is hovered</li><li><b>onViewportChange</b>
called when the viewport is manipulated</li></ul><p id="d93b">An example of showing tooltips on hover:</p><figure id="320a"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*yPThrmUuVimquBh_dxJO5A.png"><figcaption>Play with this example on <a href="https://codepen.io/vis-gl/pen/pLLQpN">Codepen</a> | <a href="https://beta.observablehq.com/@pessimistress/deck-gl-geojsonlayer-example">Observable</a></figcaption></figure><h2 id="bcee">Not A Maps Person?</h2><p id="91d6">No problem, we got you covered.</p><p id="b84e">By default, Deck layers use the <a href="https://uber.github.io/deck.gl/index.html#/documentation/developer-guide/coordinate-systems">LNGLAT coordinate system</a> and renders into a single <a href="https://uber.github.io/deck.gl/index.html#/documentation/deckgl-api-reference/views/map-view">MapView</a>.</p><p id="ea2e">If you explicitly set the views prop of your DeckGL instance, you can easily work with non-geospatial data. For example, the OrbitView is great for interactive 3d visualizations. The OrthographicView is usually used for 2d visualizations looking from top down.</p>
<figure id="53fc">
<div>
<div>
<iframe class="gist-iframe" src="/gist/Pessimistress/1154068c8514f34cdf3e368488403e10.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><figure id="e6e5"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*GlZt1ChRUN0O2FoACwg4pw.png"><figcaption>Play with this example on <a href="https://codepen.io/vis-gl/pen/mxxvqX">Codepen</a> | <a href="https://beta.observablehq.com/@pessimistress/deck-gl-pointcloudlayer-example">Observable</a></figcaption></figure><p id="82c6">Our <a href="https://codepen.io/vis-gl">codepen</a> showcase and <a href="https://beta.observablehq.com/@pessimistress">observable</a> profile has all sorts of examples to get you started. Welcome to deck.gl!</p></article></body>