forked from nrenner/brouter-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.template.js
129 lines (113 loc) · 4.21 KB
/
config.template.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
(function() {
var hostname = window.location.hostname;
var origin = window.location.protocol + '//' + hostname + (window.location.port ? ':' + window.location.port : '');
var params = new URLSearchParams(window.location.search.slice(1));
BR.conf = {};
// Switch for intermodal routing demo
BR.conf.transit = false;
// or as query parameter (index.html?transit=true#zoom=...)
// (uses search/query (?) not hash (#) params, as config only executed once at load)
// TODO not included in permalink (better replace permalink with hash plugin)
//BR.conf.transit = params.has('transit') && (params.get('transit') === 'true');
if (hostname.endsWith('brouter.de')) {
// online service (brouter.de) configuration
BR.conf.profiles = [
'trekking',
'fastbike',
'car-eco',
'car-fast',
'safety',
'shortest',
'trekking-ignore-cr',
'trekking-steep',
'trekking-noferries',
'trekking-nosteps',
'moped',
'rail',
'river',
'vm-forum-liegerad-schnell',
'vm-forum-velomobil-schnell',
'fastbike-lowtraffic',
'fastbike-asia-pacific',
'hiking-beta'
];
BR.conf.host = origin;
BR.conf.profilesUrl = origin + '/brouter/profiles2/';
} else {
// desktop configuration
BR.conf.profiles = [
'trekking',
'fastbike',
'car-eco',
'car-fast',
'shortest',
'moped',
'vm-forum-liegerad-schnell',
'vm-forum-velomobil-schnell',
'fastbike-lowtraffic',
'fastbike-asia-pacific'
];
BR.conf.host = 'http://0.0.0.0:17777';
// Pre-loading selected profile disabled locally. Needs brouter-web to run on a
// local web server with the profiles in a subdirectory or allowing file access
// in the Browser (security!), see
// https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally
//BR.conf.profilesUrl = 'http://localhost:8000/profiles2/';
//BR.conf.profilesUrl = 'file://YOUR_PATH_TO/profiles2/';
}
// Removes default base layers when 'true'. Useful for only having custom layers (see below).
BR.conf.clearBaseLayers = false;
// Add custom tile layers
// URL template see http://leafletjs.com/reference.html#tilelayer
// Multiple entries separated by comma (,)
BR.conf.baseLayers = {
// 'display name': 'url'[,]
// e.g. for offline tiles with https://github.com/develar/mapsforge-tile-server
//'Mapsforge Tile Server': 'http://localhost:6090/{z}/{x}/{y}.png'
};
// Base layer to show on start, as position number in the layer switcher, starting from 0, default is first
BR.conf.defaultBaseLayerIndex = 0;
// Initial route line transparency (0-1, overridden by stored slider setting)
BR.conf.defaultOpacity = 0.67;
// Minimum transparency slider value on load, values between 0 and 1 (0=invisible).
// 0 = no minimum, use stored setting; 1 = always reset to full visibility on load
BR.conf.minOpacity = 0.3;
BR.conf.routingStyles = {
trailer: {
weight: 5,
dashArray: [10, 10],
opacity: 0.6,
color: 'magenta'
},
track: {
weight: 5,
color: 'magenta',
opacity: BR.conf.defaultOpacity
},
trackCasing: {
weight: 8,
color: 'white',
// assumed to be same as track, see setOpacity
opacity: BR.conf.defaultOpacity
},
nodata: {
color: 'darkred'
}
};
// transit (intermodal routing) demo config
if (BR.conf.transit) {
BR.conf.profiles = [
'../im/bike',
'../im/foot',
'../im/like-bike',
'../im/like-foot',
'trekking',
'fastbike',
'shortest',
'moped',
'car-test'
];
}
// regex needs to be in sync with server, see ServerHandler.getTrackName()
BR.conf.tracknameAllowedChars = 'a-zA-Z0-9 \\._\\-';
})();