Skip to content

Instantly share code, notes, and snippets.

@jqtrde
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jqtrde/33eb88ad0638085f81e8 to your computer and use it in GitHub Desktop.
Save jqtrde/33eb88ad0638085f81e8 to your computer and use it in GitHub Desktop.
<!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.3.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.3.1/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.eyJ1IjoiamFjcXVlcyIsImEiOiJuRm9TWGYwIn0.ndryRT8IT0U94pHV6o0yng';
var tileset = 'jacques.cafcbb10';
var map = new mapboxgl.Map({
container: 'map', // container id
style: {
"layers": [{
"min-zoom": 0,
"type": "raster",
"source": "simple-tiles",
"id": "simple-tiles",
"max-zoom": 22
}],
"constants": {},
"version": 5,
"sources": {
"simple-tiles": {
"tiles": "raster",
"url": "mapbox://" + tileset,
"tileSize": 256,
"type": "raster"
}
}
},
center: [40, -74.50], // starting position
zoom: 2 // starting zoom
});
map.on('hover', function(e) {
map.featuresAt(e.point, {}, function(err, features) {
if (err) throw err;
document.getElementById('features').innerHTML = JSON.stringify(features, null, 2);
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment