From 81a81cf0fb61637997266e700ad0509372e0390a Mon Sep 17 00:00:00 2001 From: Katie Filbert Date: Sat, 1 Dec 2012 16:50:25 +0100 Subject: add geojson and fix location --- resources/map.js | 22 +++++++++++++++------- resources/op2geojson.js | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'resources') diff --git a/resources/map.js b/resources/map.js index 190f4c1..dbd437b 100644 --- a/resources/map.js +++ b/resources/map.js @@ -4,6 +4,7 @@ $(document).ready(function() { fetchLayers(); var map = L.map( 'map', { + zoom: 12, layers: [self.tileLayer, self.hospitalLayer] }); @@ -11,13 +12,19 @@ $(document).ready(function() { map.on('locationfound', onLocationFound); map.on('locationerror', onLocationError); - map.locate({setView: true, maxZoom: 16}); + map.locate({setView: true, maxZoom: 12}); initLayerControl(); function geojsonLayer() { converter = new op2geojson(); data = converter.geojson(); - return L.geoJson(data); + var style = { + "color": "#ff7800", + "weight" : 5, + "opacity" : 0.65 + }; + layer = L.geoJson(data, style); + return layer; } function fetchLayers() { @@ -50,10 +57,11 @@ $(document).ready(function() { var hospitalIcon = L.icon({ iconUrl: 'resources/img/hospital.png' }); - if (self.currentLocation) { - L.marker([self.currentLocation.lat, self.currentLocation.lng], {icon: hospitalIcon}) - .addTo(self.hospitalLayer) - .bindPopup('Hospital 1'); - } + self.hospitalLayer.addTo(map); +// if (self.currentLocation) { +// L.marker([self.currentLocation.lat, self.currentLocation.lng], {icon: hospitalIcon}) +// .addTo(self.hospitalLayer) +// .bindPopup('Hospital 1'); +// } } }); diff --git a/resources/op2geojson.js b/resources/op2geojson.js index c4d7d79..8850fa9 100644 --- a/resources/op2geojson.js +++ b/resources/op2geojson.js @@ -21,7 +21,7 @@ op2geojson = function() { point = { "geometry" : { "type" : "Point", - "coordinates" : [52.480732,13.3172386] + "coordinates" : [13.3172386,52.480732] }, "type" : "Feature", "properties" : { "name" : "Sankt Gertrauden-Krankenhaus" }, -- cgit v1.2.3