blokmap/map.html
2014-12-09 20:10:10 +01:00

64 lines
2.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Blokken in Gent</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<link rel="stylesheet" href="map.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"></script>
</head>
<body>
<div id="map"></div>
<script id="popup-template" type="text/x-handlebars-template">
<div id="resto-popup">
<h3>{{name}}</h3>
<ul>
<li><b>Adres:</b> {{address}}</li>
<li><b>Capaciteit:</b> {{capacity}}</li>
<li><b>Periode:</b> Van {{period.start}} tot {{period.end}}</li>
</ul>
Openingsuren
<ul>
<li><b>Maandag:</b> {{hours.monday}}</li>
<li><b>Dinsdag:</b> {{hours.tuesday}}</li>
<li><b>Woensdag:</b> {{hours.wednesday}}</li>
<li><b>Donderdag:</b> {{hours.thursday}}</li>
<li><b>Vrijdag:</b> {{hours.friday}}</li>
<li><b>Zaterdag:</b> {{hours.saturday}}</li>
<li><b>Zondag:</b> {{hours.sunday}}</li>
</ul>
Extra: {{extra}}
</div>
</script>
<script type="text/javascript">
var popuptemplate = Handlebars.compile($('#popup-template').html());
function onEachFeature(feature, layer) {
if (feature.properties) {
layer.bindPopup(popuptemplate(feature.properties));
}
}
$(document).ready(function() {
var map = L.map('map').setView([51.0475378, 3.7261835], 13);
var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Made by <a href="http://zeus.ugent.be">Zeus</a> with ❤!'
}).addTo(map);
$.getJSON('data.json')
.done(function(data) {
var geojson = L.geoJson(data, {
onEachFeature: onEachFeature
});
map.addLayer(geojson);
});
});
</script>
</body>
</html>