aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorWilli <willi@jups42.de>2012-12-01 14:58:59 +0100
committerWilli <willi@jups42.de>2012-12-01 14:58:59 +0100
commit56b5f65912b43b620753488ba41d04114e54d51a (patch)
treece9d6b67c59ca867e374211aa69dd901a18f95fa /resources
parente7814bbd65ea0f3c801dc651e5f671e5d01bf99a (diff)
downloadhealth-map-56b5f65912b43b620753488ba41d04114e54d51a.tar
health-map-56b5f65912b43b620753488ba41d04114e54d51a.tar.gz
added layer control, converted spaces to tabs
Diffstat (limited to 'resources')
-rw-r--r--resources/map.js28
1 files changed, 17 insertions, 11 deletions
diff --git a/resources/map.js b/resources/map.js
index aa522a6..84d7cc7 100644
--- a/resources/map.js
+++ b/resources/map.js
@@ -1,25 +1,31 @@
$(document).ready(function() {
- var map = L.map( 'map' );
+ var tileLayer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
+ maxZoom: 18,
+ attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'
+ });
- L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
- maxZoom: 18,
- attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'
- }).addTo(map);
+ var hospitalLayer = L.tileLayer("http://overpass-api.de/api/interpreter?data=[out:json];node[amenity=hospital](52.34,13.3,52.52,13.6);out;");
function onLocationFound(e) {
- var radius = e.accuracy / 2
-
- L.marker(e.latlng).addTo(map)
- .bindPopup("You are within " + radius + " meters from this point").openPopup();
+ var radius = e.accuracy / 2;
+ L.marker(e.latlng).addTo(map);
+ .bindPopup("You are within " + radius + " meters from this point").openPopup();
}
function onLocationError(e) {
- alert(e.message);
+ alert(e.message);
}
+ var map = L.map( 'map', {
+ layers: [tileLayer, hospitalLayer]
+ });
+
map.on('locationfound', onLocationFound);
map.on('locationerror', onLocationError);
map.locate({setView: true, maxZoom: 16});
-})( jQuery );
+ L.control.layers(null, {
+ "Hospitals" : hospitalLayer
+ }).addTo(map);
+});