Last active
October 12, 2018 19:35
-
-
Save elijahzarlin/f9c9ab4e8c4f3d4aec5b994e928fb9b0 to your computer and use it in GitHub Desktop.
arc layer deck gl
This file contains hidden or 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
| const map = new mapboxgl.Map({ | |
| container: "map", | |
| style: "mapbox://styles/mapbox/light-v9", | |
| center: [-122.398, 37.788], | |
| zoom: 12, | |
| pitch: 60 | |
| }); | |
| map.on("style.load", () => { | |
| // Get data for the arc map from SFMTA origin/destination routes | |
| fetch('https://raw.githubusercontent.com/uber/deck.gl/master/examples/layer-browser/data/sfmta.routes.json') | |
| .then(function(response) { | |
| const arclayer = new MapboxLayer({ | |
| id: 'my-arc', | |
| type: ArcLayer, | |
| data: response.json(), | |
| getSourcePosition: d => d.START, | |
| getTargetPosition: d => d.END, | |
| getSourceColor: d => [64, 255, 0], | |
| getTargetColor: d => [0, 128, 200] | |
| }); | |
| //Add the deck.gl arc layer to the map | |
| map.addLayer(arclayer, 'waterway-label'); | |
| }); | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment