-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavmap.js
226 lines (208 loc) · 7.32 KB
/
navmap.js
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
var lat = 30.00;
var lon = 2.50;
var projused = new ol.proj.Projection({
code: 'EPSG:3857',
extent: [-20026376.39, -20048966.10, 20026376.39, 20048966.10]
});
var projdata = new ol.proj.Projection({
code: 'EPSG:4326'
});
//------------------------------------------------------------
// Background layers
//------------------------------------------------------------
var osm = new ol.layer.Tile({source: new ol.source.OSM()});
var toner = new ol.layer.Tile({source: new ol.source.Stamen({layer: 'toner-lite'})});
var terrain = new ol.layer.Tile({source: new ol.source.Stamen({layer: 'terrain'})});
var water = new ol.layer.Tile({source: new ol.source.Stamen({layer: 'watercolor'})});
//------------------------------------------------------------
// Edwin lagen
//------------------------------------------------------------
var wikinl = new ol.layer.Vector({
source: new ol.source.Vector({
// url: 'http://wiki.wisze.net/lib/exe/fetch.php/nl/sitemap.kml',
url: 'sitemap.kml',
projection: projused,
dataProjection: projdata,
extractStyles: false,
format: new ol.format.KML({
extractStyles: true,
extractAttributes: true }),
visible: true
})
});
wikinl.set('name', 'Wiki NL');
wikinl.set('baselayer', false);
var wikien = new ol.layer.Vector({
source: new ol.source.Vector({
// url: 'http://wiki.wisze.net/lib/exe/fetch.php/en/sitemap.kml',
url: 'sitemap.kml',
projection: projused,
dataProjection: projdata,
extractStyles: false,
format: new ol.format.KML({
extractStyles: false,
extractAttributes: true }),
visible: true
})
});
wikien.set('name', 'Wiki EN');
wikien.set('baselayer', false);
//------------------------------------------------------------
// Satnav lagen
//------------------------------------------------------------
var waypoints = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://wold.xs4all.nl/cgi-bin/mapserv?map=/var/www/html/edwin/edwin.map&service=wms&',
params: {
'LAYERS': 'Waypoints',
'FORMAT': 'image/png'
},
projection: projused,
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver')
})
});
waypoints.set('name', 'Waypoints');
waypoints.set('baselayer', false);
var tracks = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://wold.xs4all.nl/cgi-bin/mapserv?map=/var/www/html/edwin/edwin.map&service=wms&',
params: {
'LAYERS': 'Tracks',
'FORMAT': 'image/png'
},
projection: projused,
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver')
})
});
tracks.set('name', 'Tracks');
tracks.set('baselayer', false);
var sports = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://wold.xs4all.nl/cgi-bin/mapserv?map=/var/www/html/edwin/edwin.map&service=wms&',
params: {
'LAYERS': 'Sports',
'FORMAT': 'image/png'
},
projection: projused,
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver')
})
});
sports.set('name', 'Sports');
sports.set('baselayer', false);
var trackpoints = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://wold.xs4all.nl/cgi-bin/mapserv?map=/var/www/html/edwin/edwin.map&service=wms&',
params: {
'LAYERS': 'Trackpoints',
'FORMAT': 'image/png'
},
projection: projused,
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver')
})
});
trackpoints.set('name', 'Trackpoints');
trackpoints.set('baselayer', false);
var activity = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://wold.xs4all.nl/cgi-bin/mapserv?map=/var/www/html/edwin/edwin.map&service=wms&',
params: {
'LAYERS': 'Activity',
'FORMAT': 'image/png'
},
projection: projused,
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver')
})
});
activity.set('name', 'Activity');
activity.set('baselayer', false);
var countries = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://wold.xs4all.nl/cgi-bin/mapserv?map=/var/www/html/edwin/edwin.map&service=wms&',
params: {
'LAYERS': 'Countries',
'FORMAT': 'image/png'
},
projection: projused,
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver')
})
});
countries.set('name', 'Countries');
countries.set('baselayer', false);
var elevation = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://wold.xs4all.nl/cgi-bin/mapserv?map=/var/www/html/edwin/edwin.map&service=wms&',
params: {
'LAYERS': 'Elevation',
'FORMAT': 'image/png'
},
projection: projused,
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver')
})
});
elevation.set('name', 'Elevation');
elevation.set('baselayer', false);
var beidou_used = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://wold.xs4all.nl/cgi-bin/mapserv?map=/var/www/html/edwin/beidou.map&service=wms&',
params: {
'LAYERS': 'Used',
'FORMAT': 'image/png'
},
projection: projused,
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver')
})
});
beidou_used.set('name', 'Used');
beidou_used.set('baselayer', false);
var beidou_points = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://wold.xs4all.nl/cgi-bin/mapserv?map=/var/www/html/edwin/beidou.map&service=wms&',
params: {
'LAYERS': 'BeidouPoints',
'FORMAT': 'image/png'
},
projection: projused,
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver')
})
});
beidou_points.set('name', 'BeidouPoints');
beidou_points.set('baselayer', false);
//------------------------------------------------------------
// The map
//------------------------------------------------------------
var navmaplayers = [ terrain, countries, tracks, waypoints ];
var sportslayers = [ toner, sports ];
var edwinlayers = [ water, wikinl, wikien ];
var beidoulayers = [ toner, beidou_used, beidou_points ];
var heightlayers = [ osm, elevation, tracks, waypoints ];
var overview = new ol.View({ projection: projused,
center: [0, 0], zoom: 2 })
var map = new ol.Map({
target: 'map',
layers: navmaplayers,
controls: ol.control.defaults().extend([ new ol.control.ScaleLine() ]),
view: overview
});
//------------------------------------------------------------
// Page functionality
//------------------------------------------------------------
map.onclick = layers;
function layers(e,topic) {
// if (e.style.color == 'red') {
// e.style.color = 'black';
// if (topic == 'overview') { map.removeLayer(trackpoints); }
// if (topic == 'beidou') { map.removeLayer(beidou);}
// if (topic == 'elevation') { map.removeLayer(elevation); }
// map.removeLayer(waypoints);
// map.addLayer(waypoints);
// map.render();
// } else {
// e.style.color = 'red';
if (topic == 'edwin') {map.setLayerGroup(new ol.layer.Group({layers: edwinlayers}));}
if (topic == 'overview') {map.setLayerGroup(new ol.layer.Group({layers: navmaplayers}));}
if (topic == 'sports') {map.setLayerGroup(new ol.layer.Group({layers: sportslayers}));}
if (topic == 'beidou') {map.setLayerGroup(new ol.layer.Group({layers: beidoulayers}));}
if (topic == 'elevation') {map.setLayerGroup(new ol.layer.Group({layers: heightlayers}));}
map.render();
// }
}