Skip to content

Instantly share code, notes, and snippets.

@ycombinator
Created July 12, 2016 14:49
Show Gist options
  • Save ycombinator/49b5e0c12a1ae4522facaaff60ac716f to your computer and use it in GitHub Desktop.
Save ycombinator/49b5e0c12a1ae4522facaaff60ac716f to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src='https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.css' rel='stylesheet' />
</head>
<body>
<div id='map' style='width: 400px; height: 300px;'></div>
<script>
// L is Leaflet
L.mapbox.accessToken = 'pk.eyJ1IjoieWNvbWJpbmF0b3I4MSIsImEiOiJjaXFqaDIxa2gwYTloZnJtMTR0cjE3dGFuIn0.9ZLKlLIK00qCDB61_ir-pQ';
var mapboxTiles = L.tileLayer('https://api.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=' + L.mapbox.accessToken, {
attribution: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
var coords = [ 51.505, -0.09 ];
var zoomLevel = 13;
var map = L.map('map')
.addLayer(mapboxTiles)
.setView(coords, zoomLevel);
</script></body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment