From 0a94d892169f26c17326b7840e420530b4bb9176 Mon Sep 17 00:00:00 2001 From: Willi Date: Sat, 1 Dec 2012 17:28:52 +0100 Subject: popup states hospial's name --- resources/map.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/resources/map.js b/resources/map.js index e5c9b06..1b28a03 100644 --- a/resources/map.js +++ b/resources/map.js @@ -16,14 +16,21 @@ $(document).ready(function() { initLayerControl(); function geojsonLayer() { - converter = new op2geojson(); - data = converter.geojson(); + var converter = new op2geojson(); + var data = converter.geojson(); var style = { - "color": "#ff7800", - "weight" : 5, - "opacity" : 0.65 + color: "red", + weight : 50, + opacity : 0.65 }; - layer = L.geoJson(data, style); + var layer = L.geoJson(data, { + style: function(feature) { + return style; + }, + onEachFeature: function(feature, layer) { + layer.bindPopup(feature.properties.name); + } + }); return layer; } @@ -33,6 +40,12 @@ $(document).ready(function() { maxZoom: 18, attribution: 'Map data © OpenStreetMap contributors' }); + // L.geoJson(self.hospitalLayer, { + // pointToLayer: function(feature, latlng) { + // debugger; + // L.circleMarker(latlng); + // } + // }) } function initLayerControl() { @@ -46,7 +59,6 @@ $(document).ready(function() { var radius = e.accuracy / 2; L.marker(e.latlng).addTo(map) .bindPopup("You are within " + radius + " meters from this point").openPopup(); - $('body').trigger('hospitalsfetched'); } function onLocationError(e) { -- cgit v1.2.3