-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
131 lines (120 loc) · 4.81 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
title: Kneipenplan
---
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>Paderborner Kneipenplan</title>
<link rel="stylesheet" href="{{ site.baseurl }}/style.css" type="text/css">
<script src="{{ site.baseurl }}/OpenLayers.js"></script>
<script type="text/javascript">
var map, select;
function init(){
var options = {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
};
map = new OpenLayers.Map('map', options);
var mapnik = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");
var bars = new OpenLayers.Layer.Vector("Kneipen & Bars", {
projection: map.displayProjection,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "{{ site.baseurl }}/kml/bars.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
})
});
var food = new OpenLayers.Layer.Vector("Essen", {
projection: map.displayProjection,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "{{ site.baseurl }}/kml/food.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
})
});
styleMap = new OpenLayers.StyleMap({'default':{
label : "${label}",
fontColor: "black",
fontSize: "14px",
fontWeight: "bold",
labelAlign: "${labelAlign}",
pointRadius: 7,
fillColor: "white",
strokeColor: "white",
labelXOffset : "0",
labelYOffset : "0"
}});
var numbered = new OpenLayers.Layer.Vector("Nummeriert", {
projection: map.displayProjection,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "{{ site.baseurl }}/kml/numbered_plan.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
}),
styleMap: styleMap
});
numbered.setVisibility(false);
map.addLayers([mapnik, numbered, bars, food]);
select = new OpenLayers.Control.SelectFeature(bars);
bars.events.on({
"featureselected": onFeatureSelect,
"featureunselected": onFeatureUnselect
});
map.addControl(select);
select.activate();
map.addControl(new OpenLayers.Control.LayerSwitcher());
var lonLat = new OpenLayers.LonLat(8.75456929206848, 51.71960448493701 )
.transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator Projection
);
map.setCenter(lonLat, 15);
}
function onPopupClose(evt) {
select.unselectAll();
}
function onFeatureSelect(event) {
var feature = event.feature;
var selectedFeature = feature;
var popup = new OpenLayers.Popup.FramedCloud("chicken",
feature.geometry.getBounds().getCenterLonLat(),
new OpenLayers.Size(100,100),
"<h2>"+feature.attributes.name + "</h2><div class='description'>" + feature.attributes.description + "</div>",
null, true, onPopupClose
);
feature.popup = popup;
map.addPopup(popup);
}
function onFeatureUnselect(event) {
var feature = event.feature;
if(feature.popup) {
map.removePopup(feature.popup);
feature.popup.destroy();
delete feature.popup;
}
}
</script>
</head>
<body onload="init()">
<div id="map" class="map"></div>
<div>
<nav class="footnav">
<ul>
<li><a href="https://github.com/codeforpb/Kneipenplan/blob/master/README.md">Über das Projekt</a></li>
</ul>
</nav>
</div>
</body>
</html>