Skip to content

Instantly share code, notes, and snippets.

@hepplerj
Created September 12, 2015 23:29
Show Gist options
  • Save hepplerj/5a7ad286feeca0afe5e3 to your computer and use it in GitHub Desktop.
Save hepplerj/5a7ad286feeca0afe5e3 to your computer and use it in GitHub Desktop.
Mapbox GL
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Mapbox GL</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.7.0/mapbox-gl.js'></script>
<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>
mapboxgl.accessToken = 'pk.eyJ1IjoiYm9iYnlzdWQiLCJhIjoiTi16MElIUSJ9.Clrqck--7WmHeqqvtFdYig';
var map = new mapboxgl.Map({
container: 'map',
style: 'https://www.mapbox.com/mapbox-gl-styles/styles/outdoors-v7.json',
center: [37.3382, -122.15],
zoom: 10
});
map.on('style.load', function() {
map.addSource("route", {
"type": "geojson"
}),
map.addLayer({
"id": "route",
"type": "fill",
"source": "route",
"paint": {
"line-color": "#888",
"line-width": 1,
"fill-color": "#888"
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment