aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-12-08 14:45:16 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-12-08 14:45:16 +0000
commiteba539d3a8721343acee1b3ab419a29bae42e2c0 (patch)
treec1bd7bc870128bc86c050ae14c2a245ae53d07b7
parente6b22a438a608b378e22b7428fbe030a7956bf5d (diff)
downloadhealth-map-eba539d3a8721343acee1b3ab419a29bae42e2c0.tar
health-map-eba539d3a8721343acee1b3ab419a29bae42e2c0.tar.gz
Add links to editors, the JOSM one appears to not work
-rw-r--r--resources/img/josm.pngbin0 -> 777 bytes
-rw-r--r--resources/img/potlatch.pngbin0 -> 766 bytes
-rw-r--r--resources/map.js46
3 files changed, 30 insertions, 16 deletions
diff --git a/resources/img/josm.png b/resources/img/josm.png
new file mode 100644
index 0000000..313d2bf
--- /dev/null
+++ b/resources/img/josm.png
Binary files differ
diff --git a/resources/img/potlatch.png b/resources/img/potlatch.png
new file mode 100644
index 0000000..d22defe
--- /dev/null
+++ b/resources/img/potlatch.png
Binary files differ
diff --git a/resources/map.js b/resources/map.js
index 4a0d80a..9ee6aec 100644
--- a/resources/map.js
+++ b/resources/map.js
@@ -2,21 +2,28 @@ $(document).ready(function() {
var self = this;
- self.popupTemplate = _.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.popupTemplate = _.template('<a href="http://www.openstreetmap.org/edit?editor=potlatch2&lat=<%= coordinate[1] %>&lon=<%= coordinate[0] %>&zoom=18">\
+<img src="resources/img/potlatch.png">\
+</a>\
+<a href="http://www.openstreetmap.org/edit?editor=remote2&lat=<%= coordinate[1] %>&lon=<%= coordinate[0] %>&zoom=18">\
+<img src="resources/img/josm.png">\
+</a>\
+<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,
@@ -77,7 +84,14 @@ $(document).ready(function() {
return {color: 'red'};
},
onEachFeature: function(feature, layer) {
- layer.bindPopup(self.popupTemplate({ properties: feature.properties }));
+ 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 }));
},
filter: function(feature, layer) {
return _.contains(_.values(feature.properties), amenity);