aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-12-09 17:41:31 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-12-09 17:41:31 +0000
commitc3a7e1eb5808d8c2a0df134f77214892c1cdefef (patch)
tree96b4877e9b2f9fbf6df796c5b5f7df232b0c0658
parent0e4c0c4653ee72bb1d8a4c3d7adadf57b0d79024 (diff)
downloadhealth-map-c3a7e1eb5808d8c2a0df134f77214892c1cdefef.tar
health-map-c3a7e1eb5808d8c2a0df134f77214892c1cdefef.tar.gz
Add popups for the catchment areas
-rw-r--r--resources/map.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/resources/map.js b/resources/map.js
index 9c0f009..14875fe 100644
--- a/resources/map.js
+++ b/resources/map.js
@@ -25,6 +25,23 @@ $(document).ready(function() {
<% }); %> \
</table>');
+ self.catchmentTemplate = _.template('<table>\
+<tr><th>Key</th><th>Value</th></tr>\
+<% _.each(properties, function(val, key) { %> \
+<% if (/\:/.exec(key)) { %> \
+<tr> \
+<td><%= key.split(":")[1] %> </td> \
+<td><%= val %> </td> \
+</tr> \
+<% } else {%> \
+<tr>\
+<td><%= key %> </td> \
+<td><%= val %> </td> \
+</tr>\
+<% } %> \
+<% }); %> \
+</table>');
+
self.tileLayer = L.tileLayer('http://{s}.www.toolserver.org/tiles/osm-no-labels/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'
@@ -95,14 +112,8 @@ $(document).ready(function() {
mouseout: resetHighlight,
click: zoomToFeature
});
- /*var center;
- if (feature.geometry.type === "Point") {
- center = feature.geometry.coordinates;
- } else {
- center = feature.geometry.coordinates[0];
- }
-
- layer.bindPopup(self.popupTemplate({ properties: feature.properties, coordinate: center }));*/
+
+ layer.bindPopup(self.catchmentTemplate({ properties: feature.properties }));
},
filter: function(feature, layer) {
return _.contains(_.values(feature.properties), "catchment_area");