D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
peterqliu
Full window
Github gist
dds example
<!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <title></title> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.18.0/mapbox-gl.js'></script> <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.18.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> mapboxgl.accessToken = 'pk.eyJ1IjoicGV0ZXJxbGl1IiwiYSI6ImpvZmV0UEEifQ._D4bRmVcGfJvo1wjuOpA1g'; var map = new mapboxgl.Map({ container: 'map', // container id style: 'mapbox://styles/peterqliu/ciog5bh8h0009a8m2oewpegt2', //stylesheet location center: [-74.50, 40], // starting position zoom: 0 // starting zoom }); mapboxgl.util.getJSON('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_month.geojson', function(err,json){ console.log(json) map.on('load', function(err, resp){ map.addSource('quakes', { type: 'geojson', data: { "type": "FeatureCollection", "features": [] } }) .addLayer({ "id": "quake", "type": "circle", "source": "quakes", "layout": { }, "paint": { "circle-color": "blue", "circle-opacity":0.1, 'circle-radius': { 'property': 'mag', 'stops': [ [0, 0], [6, 12] ] } } }); map.getSource('quakes').setData(json); }) }) </script> </body> </html>
https://api.tiles.mapbox.com/mapbox-gl-js/v0.18.0/mapbox-gl.js