From 88d5cc896adef1c0d17eca87b64a5c69d34a31d0 Mon Sep 17 00:00:00 2001 From: Willi Date: Sat, 1 Dec 2012 16:29:28 +0100 Subject: Hospital icons attached to a layer --- resources/map.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/resources/map.js b/resources/map.js index 20b5a84..190f4c1 100644 --- a/resources/map.js +++ b/resources/map.js @@ -1,4 +1,5 @@ $(document).ready(function() { + var self = this; fetchLayers(); @@ -6,11 +7,12 @@ $(document).ready(function() { layers: [self.tileLayer, self.hospitalLayer] }); - // $('body').bind('hospitalsfetched', renderHospitalIcon); + $('body').bind('hospitalsfetched', renderHospitalIcon); map.on('locationfound', onLocationFound); map.on('locationerror', onLocationError); map.locate({setView: true, maxZoom: 16}); + initLayerControl(); function geojsonLayer() { converter = new op2geojson(); @@ -46,11 +48,12 @@ $(document).ready(function() { function renderHospitalIcon() { var hospitalIcon = L.icon({ - iconUrl: 'img/hospital.png' + iconUrl: 'resources/img/hospital.png' }); if (self.currentLocation) { - debugger; - L.marker([self.location.lat, self.location.lng], {icon: hospitalIcon}).addTo(map); + L.marker([self.currentLocation.lat, self.currentLocation.lng], {icon: hospitalIcon}) + .addTo(self.hospitalLayer) + .bindPopup('Hospital 1'); } } }); -- cgit v1.2.3