Created
November 6, 2015 17:10
-
-
Save keum/af60f852fd05b8c52bd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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.11.2/mapbox-gl.js'></script> | |
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.2/mapbox-gl.css' rel='stylesheet' /> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
</style> | |
</head> | |
<body> | |
<style> | |
#features { | |
position: absolute; | |
top: 0; | |
right: 0; | |
bottom: 0; | |
width: 300px; | |
overflow: auto; | |
background: rgba(255, 255, 255, 0.8); | |
} | |
</style> | |
<div id='map'></div> | |
<pre id='features'></pre> | |
<script> | |
mapboxgl.accessToken = 'pk.eyJ1IjoianVzdGluIiwiYSI6Ijh1RmhSN2cifQ.-R7zSJ3glf2uXy5XzMWYnA'; | |
var map = new mapboxgl.Map({ | |
container: 'map', // container id | |
//style: '/style2.json', //stylesheet location | |
style: 'https://gist.githubusercontent.com/keum/3dc864880d32cd38d034/raw/904ed0fc99d79ffeede5bacc20c75106425509f1/style2.json', | |
center: [-121.50, 47], // starting position | |
zoom: 9, // starting zoom | |
hash: true | |
}); | |
map.on('mousemove', function (e) { | |
map.featuresAt(e.point, {radius: 5}, 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