From eba539d3a8721343acee1b3ab419a29bae42e2c0 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 8 Dec 2012 14:45:16 +0000 Subject: Add links to editors, the JOSM one appears to not work --- resources/img/josm.png | Bin 0 -> 777 bytes resources/img/potlatch.png | Bin 0 -> 766 bytes resources/map.js | 46 +++++++++++++++++++++++++++++---------------- 3 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 resources/img/josm.png create mode 100644 resources/img/potlatch.png (limited to 'resources') diff --git a/resources/img/josm.png b/resources/img/josm.png new file mode 100644 index 0000000..313d2bf Binary files /dev/null and b/resources/img/josm.png differ diff --git a/resources/img/potlatch.png b/resources/img/potlatch.png new file mode 100644 index 0000000..d22defe Binary files /dev/null and b/resources/img/potlatch.png 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('\ - <% _.each(properties, function(val, key) { %> \ - <% if (/\:/.exec(key)) { %> \ - \ - \ - \ - \ - <% } else {%> \ - \ - \ - \ - \ - <% } %> \ - <% }); %> \ -
KeyValue
<%= key.split(":")[1] %> <%= val %>
<%= key %> <%= val %>
'); + self.popupTemplate = _.template('\ +\ +\ +\ +\ +\ +\ +\ +<% _.each(properties, function(val, key) { %> \ +<% if (/\:/.exec(key)) { %> \ + \ + \ + \ + \ +<% } else {%> \ +\ + \ + \ +\ +<% } %> \ +<% }); %> \ +
KeyValue
<%= key.split(":")[1] %> <%= val %>
<%= key %> <%= val %>
'); 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); -- cgit v1.2.3