Last active
April 20, 2016 20:42
-
-
Save aawiseman/a450b2cebabc4525cb13f2a45281cd60 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.17.0/mapbox-gl.js'></script> | |
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.17.0/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.eyJ1IjoiYXdpc2VtYW4iLCJhIjoieE8yQk9MayJ9.nzR_1AzNT6xK2LPTaHv7Pg'; | |
var map = new mapboxgl.Map({ | |
container: 'map', | |
style: 'mapbox://styles/awiseman/cin52blh6000cb5nh414lcxel', | |
center: [-77.0238941, 38.9324389], | |
zoom: 16 | |
}); | |
map.on('mousemove', function (e) { | |
var features = map.queryRenderedFeatures(e.point); | |
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