Permalink
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
Cannot retrieve contributors at this time
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Show Me The Way</title> | |
<meta charset='utf-8' /> | |
<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/leaflet/0.5/leaflet.css' /> | |
<link rel='stylesheet' href='css/style.css' /> | |
<link rel='stylesheet' href='css/site.css' /> | |
<link rel='stylesheet' href='js/locationfilter/src/locationfilter.css' /> | |
<!--[if lte IE 8]><link rel='stylesheet' href='http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css' /><![endif]--> | |
<style> | |
#bbox { | |
position:absolute; | |
bottom:0; | |
left:0; | |
font-size:40px; | |
font-family:monospace; | |
right:0; | |
background:#fff; | |
color:#000; | |
border:0; | |
margin:0; | |
} | |
</style> | |
</head> | |
<body> | |
<div class='container'> | |
<div id='map' class='col12 full-height'></div> | |
<a target='_blank' id='bbox'></a> | |
</div> | |
<script src='//cdnjs.cloudflare.com/ajax/libs/leaflet/0.5/leaflet.js'></script> | |
<script src='js/locationfilter/src/locationfilter.js'></script> | |
<script> | |
//<![CDATA[ | |
var map = L.map('map'); | |
var osm = new L.TileLayer('//a.tiles.mapbox.com/v3/tmcw.map-d11l16t9/{z}/{x}/{y}.jpg70').addTo(map); | |
map.attributionControl.setPrefix(''); | |
map.attributionControl.addAttribution('Data <a href="http://www.openstreetmap.org/copyright">©</a> <a href="http://www.openstreetmap.org/">OpenStreetMap contributors</a>'); | |
map.setView([0, 0], 3); | |
var locationFilter = new L.LocationFilter().addTo(map); | |
locationFilter.on("change", function (e) { | |
console.log(e.bounds); | |
var bs = | |
e.bounds.getSouthWest().lat.toFixed(5) + ',' + | |
e.bounds.getSouthWest().lng.toFixed(5) + ',' + | |
e.bounds.getNorthEast().lat.toFixed(5) + ',' + | |
e.bounds.getNorthEast().lng.toFixed(5); | |
// Do something when the bounds change. | |
// Bounds are available in `e.bounds`. | |
var loc = location.href.replace('bbox.html', '').replace('bbox', '') + '#bounds=' + bs; | |
document.getElementById('bbox').textContent = loc; | |
document.getElementById('bbox').setAttribute('href', loc); | |
}); | |
//]]> | |
</script> | |
</body> | |
</html> |