diff options
author | Willi <willi@jups42.de> | 2012-12-01 16:29:28 +0100 |
---|---|---|
committer | Willi <willi@jups42.de> | 2012-12-01 16:29:28 +0100 |
commit | 88d5cc896adef1c0d17eca87b64a5c69d34a31d0 (patch) | |
tree | 499f6e509d4bfb9739ac1717048ecd91bb45d08b | |
parent | c6fdffc5a0b62c5155c7f6ab5a57bb74f041a35c (diff) | |
download | health-map-88d5cc896adef1c0d17eca87b64a5c69d34a31d0.tar health-map-88d5cc896adef1c0d17eca87b64a5c69d34a31d0.tar.gz |
Hospital icons attached to a layer
-rw-r--r-- | resources/map.js | 11 |
1 files 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'); } } }); |