<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Xiaoji Chen | 消极 on Medium]]></title>
        <description><![CDATA[Stories by Xiaoji Chen | 消极 on Medium]]></description>
        <link>https://medium.com/@cxiaoji?source=rss-1217e7ce40b3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*L3MdlKQK6tCIg70l.png</url>
            <title>Stories by Xiaoji Chen | 消极 on Medium</title>
            <link>https://medium.com/@cxiaoji?source=rss-1217e7ce40b3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 10:35:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cxiaoji/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Using deck.gl with Google Maps]]></title>
            <link>https://medium.com/vis-gl/using-deck-gl-with-google-maps-9c868d18e3cd?source=rss-1217e7ce40b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c868d18e3cd</guid>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[webgl]]></category>
            <category><![CDATA[google-maps]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Xiaoji Chen | 消极]]></dc:creator>
            <pubDate>Tue, 07 May 2019 23:31:01 GMT</pubDate>
            <atom:updated>2019-05-07T23:31:01.796Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nPyFQIRLJNQWFVfuS38KhQ.jpeg" /><figcaption>deck.gl ScatterplotLayer and ArcLayer over Google Maps (data source: Natural Earth)</figcaption></figure><p><a href="http://bl.ocks.org/Pessimistress/b5e9b86cd0f69ea69f20150734d4e2b6">Live demo</a></p><p>deck.gl was originally created to work with Mapbox GL JS. All of the examples on its website still use Mapbox as the base map. Yet, since we first open-sourced the framework, we’ve been asked on GitHub: how do you use it with Google Maps?</p><p>Both map solutions use <a href="https://en.wikipedia.org/wiki/Web_Mercator_projection">Web Mercator Projection</a>, so the same camera settings should (for the most part) yield pixel-matching views. In practice, we found there was more to it than that, so we worked with the Google Maps Platform engineering team to make it happen.</p><h4><strong>So what was the issue</strong>?</h4><p>The largest issue that delayed adding Google Maps support to deck.gl was camera synchronization. For example, when a user zooms in and out of a Google map with the scroll wheel, Google Maps always settles on an integer zoom level, and applies a smooth transition between the current and new zoom levels. For deck.gl’s visualization layers to look as a seamless part of the Google map, deck.gl must redraw its canvas on every transition frame to match itself with the base map.</p><p>To achieve this, we had two options:</p><ul><li><strong>Match the deck.gl camera with that of the base map.</strong> This requires us to listen to a camera event of the map component and update the deck.gl view state on every change. But there’s a big problem with this approach: in Google Maps, the zoom_changed event is fired only once when zoom happens, and the map.getZoom method only ever returns the target (integer) zoom level. This means there’s no way for deck.gl to stay synchronized with Google’s transition animation between zoom levels.</li><li><strong>Match the base map’s camera with that of deck.gl.</strong> This approach would require disabling the default interaction of Google Maps, and use deck.gl’s map controller to drive all camera changes. Bad news: we can’t do that either because the map.setZoom function of the Google Maps JS API doesn’t accept fractional values, meaning there is no way for external code to plug in a smooth transition logic.</li></ul><p>So neither of these options was viable. From the API perspective, Google Maps JS API doesn’t offer the fine-grain callbacks, getters and/or setters that deck.gl normally uses for camera synchronization. Additionally, we had no visibility into the animation curve used to control the camera in Google Map, so we couldn’t hack our end to produce the same look. It started to look like Google Maps support wouldn’t be possible.</p><h4>The solution</h4><p>While working on deck.gl v7.0, we partnered with developers from Google to restart the investigation into how deck.gl can work seamlessly with Google Maps. Their familiarity with the Maps API gave us the eventual breakthrough. The solution involved extending the <a href="https://developers.google.com/maps/documentation/javascript/reference/#OverlayView">OverlayView</a> API and reverse-engineering the projection matrix as well as some CSS. If you are curious, <a href="https://github.com/uber/deck.gl/blob/7.0-release/modules/google-maps/src/utils.js#L84">here is how we did it</a>.</p><p>We figured you probably don’t need to know the details, so we packaged it up and offered it as a new npm module <a href="http://deck.gl/#/documentation/submodule-api-reference/deckgl-google-maps/google-maps-overlay">@deck.gl/google-maps</a>. To use this module, you construct a GoogleMapsOverlay instance:</p><pre>import {GoogleMapsOverlay} from &#39;@deck.gl/google-maps&#39;;</pre><pre>const overlay = new GoogleMapsOverlay({<br>  // Deck props<br>});</pre><p>And then simply use it as any other Maps overlay:</p><pre>overlay.setMap(map);</pre><p>Here is what the code would look like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1dfe2879c35e5c1537e0ae5b688597b9/href">https://medium.com/media/1dfe2879c35e5c1537e0ae5b688597b9/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ueIWauR6Ue4nCJGeR4ILEg.jpeg" /><figcaption>Mapping 203K trees in Paris using Google Maps and deck.gl’s ScatterplotLayer. Data source: <a href="https://opendata.paris.fr/">https://opendata.paris.fr/</a></figcaption></figure><p><a href="https://bl.ocks.org/Pessimistress/raw/2b2dee8d3aa01d31bb97ca2671690af9/7135d4d7eef3fd36e5a245b0551dab1f7ff4ef70/">Live demo</a></p><p>All deck.gl layers and picking functionalities (e.g. onHover and onClick) work with the Google Maps integration.</p><p>The Google Maps JavaScript library does not support free rotation of the camera, so sadly the 3D layers of deck.gl may not work very well. deck.gl does not currently support zoom levels below zero, so it will hide itself when the user zooms all the way out.</p><h4>What’s next</h4><p>Because we don’t use Google Maps for internal apps at Uber, this new module might not be as battle-tested as the rest of the framework. We ask external developers to kindly provide us feedback if anything can be improved.</p><p>This is not the end of our work with Google Maps. The Google Maps API team plan on offering more of their WebGL infrastructure through the JS API and are committed to work closely with us as they bring their 3D rendering to their external developers. We love the richness of Google’s map data and its beautiful visuals. I would personally die to put my data in the same 3D space as its building models and street view.</p><p>Big thanks to everyone who worked on this feature: <a href="https://github.com/MeTaNoV">Pascal Gula</a>, <a href="https://github.com/ibgreen">Ib Green</a>, <a href="https://github.com/donmccurdy">Don McCurdy</a>, and Travis McPhail.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c868d18e3cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vis-gl/using-deck-gl-with-google-maps-9c868d18e3cd">Using deck.gl with Google Maps</a> was originally published in <a href="https://medium.com/vis-gl">vis.gl</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing deck.gl v7.0]]></title>
            <link>https://medium.com/vis-gl/introducing-deck-gl-v7-0-c18bcb717457?source=rss-1217e7ce40b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c18bcb717457</guid>
            <category><![CDATA[webgl]]></category>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Xiaoji Chen | 消极]]></dc:creator>
            <pubDate>Fri, 26 Apr 2019 18:59:07 GMT</pubDate>
            <atom:updated>2019-04-27T07:37:03.423Z</atom:updated>
            <content:encoded><![CDATA[<p><em>by Uber Visualization Frameworks Team</em></p><p>Since deck.gl’s debut as an open-source framework designed for <a href="https://kepler.gl">geospatial analytics</a>, we have continued to build boundary-pushing WebGL-powered applications at Uber, such as <a href="https://avs.auto">autonomy visualization</a>, <a href="https://neb.gl">map editing</a>, and <a href="https://eng.uber.com/manifold/">machine learning</a>. We have also seen a tremendous amount of enthusiasm from our open-source community, and learned about the unique use cases and challenges that each of our users face.</p><p>This week, we are excited to announce a new deck.gl milestone: <a href="http://deck.gl/#/documentation/overview/whats-new">v7.0</a>. This is a major step forward for the framework, with more powerful visuals, a more extensible architecture, better support for industry standards, and an easier learning curve. The internal architecture has been substantially rewritten to support a multitude of new features planned for the months to come.</p><h3>A Growing Layer Catalog</h3><p>In this release, we have added 11 new layers to deck.gl’s official layer catalog to make common scenarios easier to implement.</p><h4><a href="http://deck.gl/#/documentation/deckgl-api-reference/layers/tile-layer"><strong>TileLayer</strong></a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*IwASLkDgaFdBIPqsDMeXAg.gif" /><figcaption><em>deck.gl rendering OpenStreetMap raster tiles with the TileLayer</em></figcaption></figure><p>First introduced in deck.gl v6.3, the TileLayer has graduated from experimental status. This layer loads and renders data within the current viewport using the <a href="https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Resolution_and_Scale">OSM tile indexing system</a>. The data source, format and rendering can all be customized. It demonstrates how large datasets can be spatially-indexed and interactively loaded based on the camera. You can find examples that render <a href="http://deck.gl/#/examples/core-layers/tile-layer">raster map tiles</a> and <a href="http://deck.gl/#/documentation/deckgl-api-reference/layers/tile-layer">vector map tiles</a> on the website.</p><h4><a href="http://deck.gl/#/documentation/deckgl-api-reference/layers/bitmap-layer"><strong>BitmapLayer</strong></a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*07hv5-vxNAJbIGG1mXVtlw.png" /><figcaption><em>deck.gl overlaying a custom image over San Francisco with the BitmapLayer</em></figcaption></figure><p>The BitmapLayer places a rectangular image in world space, with options for simple image filtering effects. It is especially useful when composing vector data with satellite imagery or raster scans of the environment. Check out the <a href="http://deck.gl/showcases/gallery/bitmap-layer">weather system example</a> for how to use this layer.</p><h4><a href="http://deck.gl/#/documentation/deckgl-api-reference/layers/column-layer"><strong>ColumnLayer</strong></a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*36HqEjwLU25Q7WY9eMOVcw.png" /><figcaption><em>deck.gl showing the distribution of bike racks in San Francisco with the ColumnLayer</em></figcaption></figure><p>The ColumnLayer is a generalized replacement of the HexagonCellLayer and GridCellLayer from deck.gl v6. It renders a cylinder at each given position with specified height and color, useful for constructing 3D bar-charts that visualize density.</p><h4><a href="http://deck.gl/#/documentation/deckgl-api-reference/layers/trips-layer"><strong>TripsLayer</strong></a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*bxjOxQsSO4791dmS5pACDA.gif" /><figcaption><em>deck.gl visualizing a vehicle’s movement with the TripsLayer</em></figcaption></figure><p>The TripsLayer, as can be seen on the deck.gl <a href="https://deck.gl">home page</a>, has also graduated from experimental status. Support for customizable line width, a much-requested feature, has been restored.</p><h4><a href="http://deck.gl/#/documentation/deckgl-api-reference/layers/s2-layer"><strong>S2Layer</strong></a><strong> and </strong><a href="http://deck.gl/#/documentation/deckgl-api-reference/layers/h3-hexagon-layer"><strong>H3 Layers</strong></a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NNFjaF_Oxlw2-Zdm" /><figcaption><em>deck.gl’s S2Layer, H3HexagonLayer and H3ClusterLayer</em></figcaption></figure><p>Popular spatial indexing systems such as <a href="http://s2geometry.io/">S2</a> and <a href="https://uber.github.io/h3/#/documentation/core-library/overview">H3</a> divide the surface of the earth into linearly indexed grid cells. Geospatial data can be efficiently aggregated, filtered and queried within these systems. The new S2Layer and H3 layers make it easy to visualize datasets that use the S2 or H3 indexes.</p><p>There are more! Check out our <a href="http://deck.gl/#/documentation/overview/whats-new">what’s new</a> page for a full list.</p><h3>Loaders.gl and Mesh Layers</h3><p>In v7.0, we added a new category of layers: the mesh layers, which render an arbitrary 3D object at each given position with a specified size, orientation, and color.</p><p>To facilitate the loading of 3D models into these layers, we have released a new library — <a href="https://uber-web.github.io/loaders.gl/#/docs/overview/introduction">loaders.gl</a>, a new companion to deck.gl. Loaders.gl is an open-source collection of framework-agnostic loaders for industry-standard 3D file formats such as OBJ, PLY and glTF. All loaders in this suite output to the same consistent, standardized format.</p><p>The <a href="http://deck.gl/#/documentation/deckgl-api-reference/layers/simple-mesh-layer">SimpleMeshLayer</a> is great for rendering simple 3D models in formats such as OBJ and PLY (<a href="https://github.com/uber/deck.gl/tree/7.0-release/examples/website/mesh">example</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*AwDoGv5bPCwZabYBXS8UAg.png" /><figcaption><em>deck.gl rendering a fleet of Mini Coopers from OBJ with the SimpleMeshLayer</em></figcaption></figure><p>Most notably, we are adding initial integration with the popular <a href="https://www.khronos.org/gltf/">glTF™</a> asset format. glTF is a royalty-free specification for the efficient transmission and loading of 3D assets, with a rich ecosystem of tools and extensions. All variants of glTF 2.0 are supported, including binary .glb files as well as JSON .gltf files with binary assets in base64 encoding or in separate files.</p><p>A full scene graph can be rendered with the <a href="http://deck.gl/#/documentation/deckgl-api-reference/layers/scenegraph-layer">ScenegraphLayer</a> — a more advanced version of the SimpleMeshLayer — with experimental support for PBR (physically based rendering) materials, lights and animations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*3bcB8NDIRn7QYwzToV-X0g.gif" /><figcaption><em>deck.gl showing a horde of animated ducks from glTF with the SenegraphLayer</em></figcaption></figure><h3>Lighting Effect</h3><p>A new effects system has been rewritten from the ground up for v7.0. This will act as a foundation for many exciting visual effect features down the road. The first feature to take advantage of this new system is the LightingEffect — an easier, more comprehensive way to control the lighting for your layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/0*O7baCFsd-05mrwM6" /><figcaption><em>deck.gl showing lower Manhattan with the GeoJsonLayer, LightEffect and experimental ShadowEffect (shadow effect is WIP and not released as part of 7.0)</em></figcaption></figure><p>Light sources are now specified at a global level. All 3D layers will share the same light sources. Each layer now supports a new prop `material`, which defines how it reacts to lighting. The following light sources are supported as of 7.0:</p><ul><li><a href="http://deck.gl/#/documentation/deckgl-api-reference/lights/ambient-light">AmbientLight</a></li><li><a href="http://deck.gl/#/documentation/deckgl-api-reference/lights/point-light">PointLight</a></li><li><a href="http://deck.gl/#/documentation/deckgl-api-reference/lights/directional-light">DirectionalLight</a></li><li><a href="http://deck.gl/#/documentation/deckgl-api-reference/lights/camera-light">CameraLight</a> — a variation of the PointLight, always positioned at the camera.</li><li><a href="http://deck.gl/#/documentation/deckgl-api-reference/lights/sun-light">SunLight</a> — a variation of the DirectionalLight, automatically set based on a UTC time and the current viewport.</li></ul><p>See our <a href="http://deck.gl/#/documentation/developer-guide/using-lighting">developer guide</a> for usage examples.</p><h3>Google Maps Integration</h3><p>deck.gl has added experimental support for using Google Maps as the base map with the <a href="http://deck.gl/#/documentation/submodule-api-reference/deckgl-google-maps/overview">@deck.gl/google-maps</a> module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bzFqd8DVBU0lXA5s" /><figcaption><em>Using deck.gl over Google Maps</em></figcaption></figure><h3>Why Upgrade?</h3><p>In addition to the features highlighted above, we have also made dozens of incremental improvements to the existing API, including:</p><ul><li>First-class binary data support</li><li>Support for switching between pixel sizes and meter sizes</li><li>Support for toggling billboard mode in IconLayer and TextLayer</li><li>Projection and interaction bug fixes of OrthographicView and OrbitView for info-vis use cases</li><li>Improved picking performance</li><li>Improved React performance and synchronization with the base map</li><li>Improved dependency management to reduced version conflicts and bundle size</li></ul><p>Make sure to check out the <a href="http://deck.gl/#/documentation/overview/upgrade-guide">upgrade guide</a> page for deprecations and breaking changes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c18bcb717457" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vis-gl/introducing-deck-gl-v7-0-c18bcb717457">Introducing deck.gl v7.0</a> was originally published in <a href="https://medium.com/vis-gl">vis.gl</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[deck.gl and Mapbox GL JS: Better Together]]></title>
            <link>https://medium.com/vis-gl/deckgl-and-mapbox-better-together-47b29d6d4fb1?source=rss-1217e7ce40b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/47b29d6d4fb1</guid>
            <category><![CDATA[mapping]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[webgl]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Xiaoji Chen | 消极]]></dc:creator>
            <pubDate>Mon, 15 Oct 2018 16:01:05 GMT</pubDate>
            <atom:updated>2018-10-15T16:01:05.509Z</atom:updated>
            <content:encoded><![CDATA[<p>deck.gl, Uber’s large-scale WebGL-powered data visualization framework, and Mapbox GL JS are frequently used together to create compelling geospatial visualizations. deck.gl’s <strong><em>MapView</em></strong> is designed to work in tandem with Mapbox basemaps — the same camera settings (center, zoom, pitch, and bearing) in both libraries will produce seamlessly matched results. We use Mapbox as a backdrop for deck.gl’s visualization layers in nearly all of Uber’s geospatial data applications.</p><p>Mapbox GL JS’s latest release (v0.50) enables third-party layers to draw into the same WebGL context that a Mapbox map is rendered in. This opens many new possibilities for even more tightly integrated geospatial visualizations. For example, a deck.gl GeoJSON layer can be inserted in between Mapbox’s base geographic and label layers, so that filled polygons no longer cover up the map labels. deck.gl’s arc layer and Mapbox’s buildings layer may cohabit the airspace of a city, with 3D elements correctly obscuring each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K3DVssEhnv5VaDCp" /><figcaption><em>Standard usage (separate context)</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*faYL1UbVD4af5qzy" /><figcaption><em>Integrated usage (single context)</em></figcaption></figure><p>We are excited to announce that deck.gl is supporting these scenarios on day zero with release v6.2 by adding a new module, @deck.gl/mapbox, to the Uber data visualization family.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gpyoB_dfmara_p5jBygupw.gif" /><figcaption><em>Example mixing deck.gl and mapbox layers</em></figcaption></figure><h3>Getting Started</h3><p>The new experimental class, <strong><em>MapboxLayer</em></strong>, is an implementation of Mapbox GL JS’s custom layer interface. It can be imported either via the npm module:</p><pre>npm install @deck.gl/mapbox</pre><pre>import {MapboxLayer} from ‘@deck.gl/mapbox’;</pre><p>Or the <a href="https://medium.com/vis-gl/start-scripting-with-deck-gl-c9036d7a6011">deck.gl standalone bundle</a>:</p><pre>&lt;script src=”https://unpkg.com/deck.gl@^6.2.0/deckgl.min.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=’https://api.tiles.mapbox.com/mapbox-gl-js/v0.50.0/mapbox-gl.js&#39;&gt;&lt;/script&gt;<br>&lt;script type=”text/javascript”&gt;<br> const {MapboxLayer} = deck;<br>&lt;/script&gt;</pre><p>Instances of <strong><em>MapboxLayer</em></strong> can be added to Mapbox’s layer stack using <a href="https://www.mapbox.com/mapbox-gl-js/example/geojson-layer-in-stack/">map.addLayer()</a>. The class constructor comes with two flavors, one for Mapbox developers and one for deck.gl developers.</p><h4>Using deck.gl layers as a Mapbox add-on</h4><p>You may make a <strong><em>MapboxLayer</em></strong> using any layer type from <a href="http://deck.gl/#/documentation/deckgl-api-reference/layers/layer">deck.gl’s layer catalog</a> and its corresponding props:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83bb1c60cf33f9cb52b98e3e994ebb3b/href">https://medium.com/media/83bb1c60cf33f9cb52b98e3e994ebb3b/href</a></iframe><p><a href="https://bl.ocks.org/Pessimistress/432693e986ff34c976a2fc57b9c9e2d9">Live demo</a></p><p>Note that when used this way, WebGL2-based deck.gl features, such as attribute transitions and GPU accelerated aggregation, are not supported.</p><h4>Adding Mapbox integration to deck.gl React apps</h4><p>It is also easy to modify a working deck.gl React app to leverage the new Mapbox integration. To do this:</p><ul><li>Upgrade the app’s react-map-gl dependency to version 4.0.0-beta. This version allows us to supply the WebGL context that deck.gl created for Mapbox to draw into.</li><li>Pass layers into a &lt;DeckGL/&gt; component as usual.</li><li>When the Mapbox map is loaded, we create and add <strong><em>MapboxLayer</em></strong>s to Mapbox by referencing the id of an existing layer in the deck.gl stack.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b33aa94455adf8cd40acd343f43760d7/href">https://medium.com/media/b33aa94455adf8cd40acd343f43760d7/href</a></iframe><h3>Integration examples</h3><h4><strong>Road Accidents in the U.K.</strong></h4><p>This visualization depicts personal injury road accidents in the U.K. from 1979 through 2016. It uses deck.gl’s HexagonLayer to aggregate data within the boundary of each hexagon cell. The HexagonLayer is inserted underneath Mapbox’s label layers. <a href="https://bl.ocks.org/Pessimistress/1a4f3f5eb3b882ab4dd29f8ac122a7be">Click here to explore</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pXxE1gg-w8JNZuP_" /><figcaption>Road Safety in the UK (data source: <a href="https://data.gov.uk/">data.gov.uk</a>)</figcaption></figure><h4><strong>US County-to-County Migration</strong></h4><p>This visualization shows county-to-county migration in the U.S. between 2009–2013. Hover over the map to see the people moving in and out of any particular region. It uses a custom deck.gl layer that filters arcs based on mouse position. <a href="https://bl.ocks.org/Pessimistress/dc2becf3809c67dc443b4dbab1b9a46f">Click here to explore</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hL-hZsgDLejU1B-T" /><figcaption>US County-to-County Migration (data source: <a href="http://www.census.gov/">US Census Bureau</a>)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47b29d6d4fb1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vis-gl/deckgl-and-mapbox-better-together-47b29d6d4fb1">deck.gl and Mapbox GL JS: Better Together</a> was originally published in <a href="https://medium.com/vis-gl">vis.gl</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Start Scripting with deck.gl]]></title>
            <link>https://medium.com/vis-gl/start-scripting-with-deck-gl-c9036d7a6011?source=rss-1217e7ce40b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9036d7a6011</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webgl]]></category>
            <category><![CDATA[prototyping]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Xiaoji Chen | 消极]]></dc:creator>
            <pubDate>Tue, 24 Apr 2018 20:02:49 GMT</pubDate>
            <atom:updated>2018-04-24T20:10:59.060Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="http://deck.gl">deck.gl</a> is designed to make WebGL-based visualization simple. It powers many web applications at Uber that visualize large data sets with high performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZgSJmwqqkYdpmW2TvqeIyg.jpeg" /><figcaption>Check out our <a href="https://uber.github.io/deck.gl/#/examples">gallery of examples</a></figcaption></figure><p>Up until now, most of the deck.gl examples were dependent on <a href="https://reactjs.org/">React</a>. React is a great framework for making complex web applications, but an overkill for prototyping. There are times we just want to quickly check the shape of some data, play with ideas, and share the result without having to deal with npm dependencies, a JavaScript compiler, bundler or a dev server.</p><p>As we release deck.gl v5.2.0, we are also adding a standalone bundled version of the library. It offers a native JavaScript scripting interface like that of d3.js. You can now use deck.gl in prototype environments such as <a href="https://codepen.io">Codepen</a>, <a href="https://jsfiddle.net/">JSFiddle</a> and <a href="https://www.observablehq.com">Observable</a>. We hope that this effort makes it easier for designers, creative coders and data scientists everywhere to leverage WebGL for interactive visualizations.</p><h4>My First deck.gl App</h4><p>A webpage may now include a single-file version of deck.gl using the script tag: <a href="https://unpkg.com/deck.gl@~5.2.0-beta/deckgl.min.js">https://unpkg.com/deck.gl@~5.2.0/deckgl.min.js</a>. This adds an object <strong>deck</strong> to the global scope.</p><p>Copy the following code into a text editor, save as <em>index.html</em>, and double click to open in a browser:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0dc0ab9448d677435a67bc44c8dc235/href">https://medium.com/media/b0dc0ab9448d677435a67bc44c8dc235/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1QJaRPg70J5lZZgHd6j8Jg.png" /><figcaption>Try this example on <a href="https://codepen.io/vis-gl/pen/mxxzdw">Codepen</a> | <a href="https://beta.observablehq.com/@pessimistress/deck-gl-playground">Observable notebook</a></figcaption></figure><p>In the following sections I will walk through the basic usage of the deck.gl scripting API.</p><h4>DeckGL Scripting API</h4><p>To start visualizing data with WebGL, you need to initialize a DeckGL instance:</p><pre>const deckgl = new deck.DeckGL(props);</pre><p>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>As a start, you may want to tweak these props to your own scenario:</p><ul><li><strong>container</strong><br>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><strong>longitude<br>latitude<br>zoom<br>pitch<br>bearing</strong><br>The initial view states of a geospatial visualization.</li><li><strong>controller</strong><br>By default, the Deck canvas is fully interactive — you can zoom, rotate and pan around. Set <strong>controller</strong> to <em>false</em> to disable interaction.</li><li><strong>map<br>mapStyle<br>mapboxApiAccessToken</strong><br>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 <strong>map</strong> to <em>false</em>.<br>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><h4>Layers</h4><p>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 <strong>{coordinates, count, address}</strong> 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><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac0041c3a48a73fd002c83e7ed21f85b/href">https://medium.com/media/ac0041c3a48a73fd002c83e7ed21f85b/href</a></iframe><p>Here is an example of updating a layer based on user-provided parameters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/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>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 layer catalog</a>.</p><h4>Interactions</h4><p>deck.gl makes it easy to interact with objects rendered in the 3d scene. To make a layer interactive, turn on the <strong>pickable</strong> prop:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/449c2632a6d67dbbfcc49c5154f0099f/href">https://medium.com/media/449c2632a6d67dbbfcc49c5154f0099f/href</a></iframe><p>Aside from per-layer interaction, you may also listen to user events on the entire <strong>DeckGL</strong> canvas. Some useful <strong>DeckGL</strong> callback props are:</p><ul><li><strong>onLayerClick</strong><br>called when any layer is clicked</li><li><strong>onLayerHover</strong><br>called when any layer is hovered</li><li><strong>onViewportChange</strong><br>called when the viewport is manipulated</li></ul><p>An example of showing tooltips on hover:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/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><h4>Not A Maps Person?</h4><p>No problem, we got you covered.</p><p>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>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><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfa28665d4450d3cb591fda5f9101be3/href">https://medium.com/media/dfa28665d4450d3cb591fda5f9101be3/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/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>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><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9036d7a6011" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vis-gl/start-scripting-with-deck-gl-c9036d7a6011">Start Scripting with deck.gl</a> was originally published in <a href="https://medium.com/vis-gl">vis.gl</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>