D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
turban
Full window
Github gist
Mapbox GL JS
<!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <title></title> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.7.0/mapbox-gl.css' rel='stylesheet' /> <style> body { margin:0; padding:0; } #map { position:absolute; top:0; bottom:0; width:100%; } </style> </head> <body> <div id='map'></div> <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.7.0/mapbox-gl.js'></script> <script> mapboxgl.accessToken = 'pk.eyJ1IjoidHVyYmFuIiwiYSI6ImZQaVhCQU0ifQ.X3SS6YechVVo-1G3EXfnCA'; var options = { container: 'map', style: 'https://www.mapbox.com/mapbox-gl-styles/styles/emerald-v7.json', center: [60.604, 7.502], zoom: 7 }; var map = new mapboxgl.Map(options); map.addControl(new mapboxgl.Navigation({position: 'topright'})); map.on('style.load', function() { mapboxgl.util.getJSON("https://turban.cartodb.com/api/v2/sql?q=SELECT the_geom, placename AS name, datetime FROM SPOT WHERE timestamp BETWEEN 1427283000 AND 1429367400 AND message_type = 'OK' ORDER BY timestamp&format=geojson", function (err, geojson) { if (err) throw err; map.addSource('markers', { type: 'geojson', data: geojson }); map.addLayer({ "id": "markers", "type": "symbol", "source": "markers", "layout": { "icon-image": "lodging-12", "text-field": "{name}", "text-font": "Open Sans Semibold, Arial Unicode MS Bold", "text-offset": [1, 0], "text-anchor": "left" }, "paint": { "text-size": 12 } }); }); mapboxgl.util.getJSON('https://turban.cartodb.com/api/v2/sql?q=SELECT ST_MakeLine(the_geom ORDER BY timestamp) AS the_geom FROM spot WHERE timestamp BETWEEN 1427283000 AND 1429367400&format=geojson', function (err, geojson) { if (err) throw err; map.addSource('route', { type: 'geojson', data: geojson }); map.addLayer({ id: 'route', type: 'line', source: 'route', layout: { 'line-join': 'round', 'line-cap': 'round' }, paint: { 'line-color': '#333', 'line-width': 4 } }); }); }); </script> </body> </html>
https://api.tiles.mapbox.com/mapbox-gl-js/v0.7.0/mapbox-gl.js