summaryrefslogtreecommitdiff
path: root/src/js/tours.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/tours.js')
-rw-r--r--src/js/tours.js52
1 files changed, 14 insertions, 38 deletions
diff --git a/src/js/tours.js b/src/js/tours.js
index 0224d29..7149289 100644
--- a/src/js/tours.js
+++ b/src/js/tours.js
@@ -4,7 +4,10 @@ requirejs(['./slippymap'], function(_foo) {
requirejs.config({
baseUrl: depth + 'js/lib',
});
- requirejs(['app/mapfactory'], function(mkmap) {
+ requirejs([
+ 'app/mapfactory',
+ 'json!data/tours.json'
+ ], function(mkmap, tours) {
L.Icon.Default.imagePath = depth + 'img/leaflet/';
var map = mkmap('map', [
[55.76846, 12.45369],
@@ -46,53 +49,26 @@ function highlightFeature(e) {
function resetHighlight(e) {
geojson.resetStyle(e.target);
}
+function popup (e) {
+ var layer = e.target;
+ return '<a href="'+layer.feature.properties.link+'">'+layer.feature.properties.link+'</a>';
+}
function onEachFeature(feature, layer) {
layer.on({
+ click: popup,
mouseover: highlightFeature,
mouseout: resetHighlight
});
}
-var polygon = L.polygon([
- [55.73275, 12.56572],
- [55.73247, 12.56692],
- [55.73054, 12.56748],
- [55.73009, 12.56836],
- [55.72909, 12.57631],
- [55.72954, 12.57648],
- [55.72776, 12.57587],
- [55.72289, 12.57769],
- [55.72165, 12.57746],
- [55.72165, 12.58291],
- [55.71251, 12.58621],
- [55.69607, 12.59308],
- [55.7011, 12.59643],
- [55.6951, 12.59359],
- [55.69916, 12.59153],
- [55.69607, 12.5796],
- [55.69094, 12.57136],
- [55.69621, 12.56149],
- [55.70647, 12.56278],
- [55.70352, 12.5584],
- [55.71009, 12.55497],
- [55.71106, 12.55325],
- [55.71466, 12.55879],
- [55.71913, 12.56437],
- [55.71986, 12.56261],
- [55.71986, 12.5613],
- [55.72191, 12.56355],
- [55.72242, 12.56136],
- [55.72533, 12.56162],
- [55.73127, 12.56357],
- [55.73131, 12.56424],
- [55.73124, 12.566]
- ]);
-
-geojson = L.geoJson(polygon.toGeoJSON(), {
+geojson = L.geoJson(tours, {
style: style,
onEachFeature: onEachFeature
+//}).bindPopup(function (layer) {
+// return '<a href="'+layer.feature.properties.link+'">'+layer.feature.properties.link+'</a>';
}).addTo(map);
-geojson.bindPopup("<a href=../../osterbro/>Ture på Østerbro</a>");
+//geojson.bindPopup("<a href=../../osterbro/>Ture på Østerbro</a>");
+//geojson.bindPopup(popup);
var polygon = L.polygon([
[55.69916, 12.59171],
[55.69505, 12.59359],