-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtransport.validator.mapcss
441 lines (389 loc) · 14.1 KB
/
transport.validator.mapcss
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
meta
{
title: "Jungle Bus - validation ruleset";
version: "0.13";
description: "Uncompromising validation of transit data";
author: "nlehuby";
link: "https://junglebus.io/";
baselanguage: "en";
watch-modified: true;
min-josm-version: 14481;
-osmoseTags: list("tag", "public_transport");
}
meta[lang=en] /* lang=en, unused, only to use tr() to catch string for translation */
{
description: tr("Uncompromising validation of transit data");
}
meta[lang=cs]
{
description: "Nekompromisní validace údajů o tranzitu";
}
meta[lang=es]
{
description: "Validación inflexible de los datos de tránsito";
}
meta[lang=fr]
{
description: "Une validation intransigeante des données de transport en commun";
}
meta[lang=hu]
{
description: "Tömegközlekedési adatok teljes körű érvényesítése";
}
meta[lang=it]
{
description: "Validazione senza compromessi sui dati di transito";
}
meta[lang=ja]
{
description: "乗り換えデータの妥協のないバリデーション";
}
meta[lang=nl]
{
description: "Compromisloze validatie van transit data";
}
meta[lang=ru]
{
description: "Валидатор транспорта";
}
meta[lang=uk]
{
description: "Безкомпромісна валідація транзитних даних";
}
meta[lang=zh_CN]
{
description: "运输数据不妥协的验证";
}
meta[lang=zh_TW]
{
description: "未妥協驗證的運輸資料";
}
relation[type=route][!route][!disused:route]
{
throwError: tr("Missing transportation mode, add a tag route = bus/coach/tram/etc");
}
relation[type=route_master][!route_master][!route][!disused:route_master]
{
throwError: tr("Missing transportation mode, add a tag route = bus/coach/tram/etc");
}
/*the transport mode is specified with the wrong tag */
relation[type=route_master][!route_master][route]
{
throwError: tr("Missing transportation mode, change tag route to route_master");
fixChangeKey: "route=>route_master";
}
relation[type=route][route=~/^(bus|coach|train|subway|monorail|trolleybus|aerialway|funicular|ferry|tram|share_taxi|light_rail|school_bus|walking_bus)$/]
{
set pt_route;
}
relation[type=route_master][route_master=~/^(bus|coach|train|subway|monorail|trolleybus|aerialway|funicular|ferry|tram|share_taxi|light_rail|school_bus|walking_bus)$/]
{
set pt_route_master;
}
way <[role="route"] relation.pt_route,
way <[role="forward"] relation.pt_route,
way <[role="backward"] relation.pt_route,
way <[role="reverse"] relation.pt_route,
way <[role="forward:stop"] relation.pt_route,
way <[role="backward:stop"] relation.pt_route
{
set pt_route_probably_v1;
}
relation[type=route_master] > relation[type=route]
{
set route_in_master;
}
relation.route_in_master.pt_route,
node[public_transport=stop_position] < relation.pt_route,
node <[role="platform"] relation.pt_route,
*[public_transport=platform] < relation.pt_route
{
set pt_route_probably_v2;
}
relation.pt_route_probably_v1[!public_transport:version]!.pt_route_probably_v2
{
throwError: tr("Missing public_transport:version=1 on a public_transport relation");
-osmoseItemClassLevel: none;
fixAdd: "public_transport:version=1";
}
relation.pt_route_probably_v2[!public_transport:version]!.pt_route_probably_v1
{
throwError: tr("Missing public_transport:version=2 on a public_transport relation");
-osmoseItemClassLevel: none;
fixAdd: "public_transport:version=2";
}
relation.pt_route[!public_transport:version]!.pt_route_probably_v1!.pt_route_probably_v2,
relation.pt_route[!public_transport:version].pt_route_probably_v1.pt_route_probably_v2
{
throwError: tr("Missing public_transport:version tag on a public_transport route relation");
-osmoseItemClassLevel: none;
assertNoMatch: "relation type=route route=bus public_transport:version=1";
assertMatch: "relation type=route route=bus";
}
@supports not (user-agent: josm) {
relation.pt_route[!public_transport:version]
{
throwError: tr("Missing public_transport:version tag on a public_transport route relation");
-osmoseItemClassLevel: "2140/21401/3";
assertNoMatch: "relation type=route route=bus public_transport:version=1";
assertMatch: "relation type=route route=bus";
}
}
relation.pt_route[!network],
relation.pt_route_master[!network]
{
throwError: tr("Missing network tag on a public_transport relation");
-osmoseItemClassLevel: "2140/21402/3";
assertNoMatch: "relation type=route route=bus network=BiBiBus";
assertMatch: "relation type=route route=bus";
}
relation.pt_route[!operator],
relation.pt_route_master[!operator]
{
throwError: tr("Missing operator tag on a public_transport relation");
-osmoseItemClassLevel: "2140/21403/3";
assertNoMatch: "relation type=route route=bus operator=BiBiBus";
assertMatch: "relation type=route route=bus";
}
relation.pt_route[!ref],
relation.pt_route_master[!ref]
{
throwWarning: tr("Missing ref tag for line number on a public_transport relation");
-osmoseItemClassLevel: none;
assertNoMatch: "relation type=route route=bus ref=3";
assertMatch: "relation type=route route=bus";
}
relation.pt_route[!from],
relation.pt_route[!to]
{
throwError: tr("Missing from/to tag on a public_transport route relation");
-osmoseItemClassLevel: "2140/21405/3";
assertNoMatch: "relation type=route route=bus from=A to=B";
assertMatch: "relation type=route route=bus from=A";
assertMatch: "relation type=route route=bus to=B";
assertMatch: "relation type=route route=bus";
}
relation.pt_route[tag(network)!=parent_tag(network)]
{
throwError: tr("The network tag should be the same for the route and the route_master : {0} vs {1}", tag(network), parent_tag(network));
}
relation.pt_route[tag(operator)!=parent_tag(operator)]
{
throwError: tr("The operator tag should be the same for the route and the route_master : {0} vs {1}", tag(operator), parent_tag(operator));
}
relation.pt_route[tag(ref)!=parent_tag(ref)]
{
throwWarning: tr("The ref tag should be the same for the route and the route_master : {0} vs {1}", tag(ref), parent_tag(ref));
}
relation.pt_route[tag(colour)!=parent_tag(colour)]
{
throwWarning: tr("The colour tag should be the same for the route and the route_master : {0} vs {1}", tag(colour), parent_tag(colour));
}
relation.pt_route[tag(route)!=parent_tag(route_master)]
{
throwError: tr("The public transport mode should be the same for the route and the route_master : {0} vs {1}", tag(route), parent_tag(route_master));
}
relation.pt_route[colour][colour=~/^#/][colour!~/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/],
relation.pt_route_master[colour][colour=~/^#/][colour!~/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
{
throwError: tr("Check the colour tag");
-osmoseItemClassLevel: none;
}
relation.pt_route[colour][colour=~/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/],
relation.pt_route_master[colour][colour=~/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/]
{
throwError: tr("The colour code should start with '#' followed by 3 or 6 digits");
fixAdd: concat("colour=#", tag(colour));
-osmoseItemClassLevel: none;
}
relation.pt_route[!colour][color],
relation.pt_route_master[!colour][color]
{
throwError: tr("The color of the public transport line should be in a colour tag");
fixChangeKey: "color=>colour";
}
relation.pt_route["fixme:relation"="order members"]
{
throwWarning: tr("The stops may not be in the right order");
-osmoseItemClassLevel: none;
}
/* These values are not valid operator or network */
relation.pt_route["operator"=~/STIF|Kéolis|Véolia/][inside("FR")],
relation.pt_route_master["operator"=~/STIF|Kéolis|Véolia/][inside("FR")]
{
throwError: tr("Check the operator tag : this operator does not exist, it may be a typo");
}
relation.pt_route["network"=~/STIF|Kéolis|Véolia/][inside("FR")],
relation.pt_route_master["network"=~/STIF|Kéolis|Véolia/][inside("FR")]
{
throwError: tr("Check the network tag : this network does not exist, it may be a typo");
}
way[highway=bus_stop],
relation[highway=bus_stop]
{
throwError: tr("A bus stop is supposed to be a node");
}
node[highway=bus_stop][amenity=bus_station]
{
throwError: tr("Is it a bus stop or a bus station?");
fixRemove: "amenity";
}
node[amenity=bus_station]
{
throwWarning: tr("A bus station is usually a large area where many buses stop, check if you can draw this area");
-osmoseItemClassLevel: none;
}
node[highway=bus_stop][!public_transport]
{
throwError: tr("Specify if it is a stop (platform) or a location on the road (stop_position)");
group: tr("Missing public_transport tag on a public transport stop");
-osmoseItemClassLevel: "2140/21411:0/3";
fixAdd: "public_transport=platform";
assertNoMatch: "node highway=bus_stop public_transport=platform";
assertNoMatch: "node highway=bus_stop public_transport=stop_position";
assertMatch: "node highway=bus_stop";
}
node[railway=tram_stop][!public_transport]
{
throwError: tr("Specify if it is a stop (platform) or a location on the rails (stop_position)");
group: tr("Missing public_transport tag on a public transport stop");
-osmoseItemClassLevel: "2140/21411:1/3";
fixAdd: "public_transport=stop_position";
assertNoMatch: "node railway=tram_stop public_transport=platform";
assertNoMatch: "node railway=tram_stop public_transport=stop_position";
assertMatch: "node railway=tram_stop";
}
node[public_transport=platform][!highway][!railway][!bus][!tram][!ferry][!walking_bus]
{
throwError: tr("Is this a bus or tram stop ? Add a tag to precise the kind of platform");
group: tr("Missing legacy tag on a public transport stop");
-osmoseItemClassLevel: "2140/21412:1/3";
}
node[public_transport=platform][!highway][!railway][bus=yes]
{
throwError: tr("Is this a bus stop? add the tag highway=bus_stop");
group: tr("Missing legacy tag on a public transport stop");
-osmoseItemClassLevel: "2140/21412:0/3";
fixAdd: "highway=bus_stop";
assertMatch: "node public_transport=platform bus=yes"
}
/* The note tag is often used to specify the bus routes or other useful metadata that should have their own tag */
node[highway=bus_stop][note],
node[highway=bus_stop][note:fr][inside("FR")]
{
throwWarning: tr("Check if the note can be deleted");
}
node[highway=bus_stop][network][inside("FR")]
{
throwWarning: tr("The network should be on the transport lines and not on the stops");
fixRemove: "network";
}
node[highway=bus_stop][operator][inside("FR")]
{
throwWarning: tr("The operator should be on the transport lines and not on the stops");
fixRemove: "operator";
}
relation[type=route_master] > relation[type=route]
{
set route_ok
}
relation.pt_route!.route_ok
{
throwError: tr("The line variant does not belong to any line, add it to the route_master relation");
}
relation[type=route] > node[public_transport=platform]
{
set platform_in_route
}
relation[type=route] > way[public_transport=platform]
{
set way_platform_in_route
}
node[public_transport=platform]!.platform_in_route
{
throwError: tr("The stop is not served by any line, add it to a route relation");
-osmoseItemClassLevel: none;
}
node.platform_in_route[!name]
{
throwWarning: tr("Missing name on a public transport stop");
-osmoseItemClassLevel: none;
}
way.way_platform_in_route[!name]
{
throwWarning: tr("Missing name on a public transport stop");
-osmoseItemClassLevel: none;
}
relation.pt_route[interval][interval !~ /^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$/],
relation.pt_route_master[interval][interval !~ /^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$/]
{
throwError: tr("The interval is invalid (try a number of minutes)");
assertMatch: "relation type=route route=bus interval=irregular";
assertMatch: "relation type=route route=ferry interval=2heures";
assertNoMatch: "relation type=route route=bus interval=5";
assertNoMatch: "relation type=route route=bus interval=10";
assertNoMatch: "relation type=route route=bus interval=120";
assertMatch: "relation type=route_master route_master=bus interval=1240";
assertNoMatch: "relation type=route route=bus interval=00:05";
assertNoMatch: "relation type=route route=bus interval=00:10:00";
assertNoMatch: "relation type=route route=bus interval=02:00:00";
assertMatch: "relation type=route route=bus interval=00:70:00";
}
relation.pt_route[duration][duration !~ /^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$/],
relation.pt_route_master[duration][duration !~ /^([0-9][0-9]?[0-9]?|[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)$/]
{
throwError: tr("The duration is invalid (try a number of minutes)");
assertMatch: "relation type=route route=bus duration=20minutes";
assertNoMatch: "relation type=route_master route_master=bus duration=5";
assertNoMatch: "relation type=route route=ferry duration=20";
assertNoMatch: "relation type=route route=ferry duration=120";
assertMatch: "relation type=route route=ferry duration=1240";
assertNoMatch: "relation type=route_master route=bus duration=02:00:00";
assertNoMatch: "relation type=route route=bus duration=25:00";
}
relation.pt_route["interval:conditional"][!interval],
relation.pt_route_master["interval:conditional"][!interval]
{
throwError: tr("Missing interval tag to specify the main interval");
}
relation.pt_route["interval:conditional"][!opening_hours],
relation.pt_route_master["interval:conditional"][!opening_hours]
{
throwError: tr("Missing opening_hours tag");
}
way[railway=subway_entrance],
relation[railway=subway_entrance],
way[railway=train_station_entrance],
relation[railway=train_station_entrance]
{
throwError: tr("Subway entrances should be mapped as nodes");
assertMatch: "way railway=subway_entrance";
}
relation[public_transport=stop_area] > node[railway=subway_entrance]
{
set subway_entrance_in_stop_area
}
relation[public_transport=stop_area] > node[railway=train_station_entrance]
{
set train_station_entrance_in_stop_area
}
node[railway=subway_entrance]!.subway_entrance_in_stop_area,
node[railway=train_station_entrance]!.train_station_entrance_in_stop_area
{
throwError: tr("The station entrance should be in part of a station: add it to a stop_area relation");
-osmoseItemClassLevel: none;
}
way > node[railway=subway_entrance]
{
set subway_entrance_in_way
}
way > node[railway=train_station_entrance]
{
set train_station_entrance_in_way
}
node[railway=subway_entrance]!.subway_entrance_in_way,
node[railway=train_station_entrance]!.train_station_entrance_in_way
{
throwWarning: tr("The station entrance should be part of a building or a highway (steps, footway, etc)");
-osmoseItemClassLevel: none;
}