localities.adoc
... ...
@@ -11,7 +11,10 @@
11 11
12 12
== Being worked on
13 13
14
+* UK/GB provided by UK Depertment for Transport
15
+* NL provided by OVapi
16
+* [[Transitous|localities/transitous]]
17
+
14 18
== Future
15 19
16
-* UK/GB provided by UK Depertment for Transport
17 20
localities/transitous.adoc
... ...
@@ -0,0 +1,750 @@
1
+= Transitous
2
+
3
+https://transitous.org/
4
+
5
+== API
6
+
7
+Upstream documentation:
8
+
9
+* https://routing.spline.de/doc/index.html
10
+* https://motis-project.de/docs/api/
11
+
12
+=== Searching stops
13
+
14
+.Request documentation
15
+[source,json]
16
+----
17
+{
18
+ "destination": {
19
+ "type": "Module",
20
+ "target": "/guesser"
21
+ },
22
+ "content_type": "StationGuesserRequest",
23
+ "content": {
24
+ "input": "$query", # query
25
+ "gues_count": "$count" # how many results to return
26
+ }
27
+}
28
+----
29
+
30
+.Request example
31
+[source,sh]
32
+----
33
+curl 'https://routing.spline.de/api/' \
34
+ -H 'content-type: application/json' \
35
+ --data-raw '{"destination":{"type":"Module","target":"/guesser"},"content_type":"StationGuesserRequest","content":{"input":"tower hill","guess_count":6}}'
36
+----
37
+
38
+.Response documentation
39
+[source,json]
40
+----
41
+{
42
+ "content": {
43
+ "guesses": [
44
+ {
45
+ "id": "$stopID", # stop ID
46
+ "name": "$stopName", # stop name
47
+ "pos": {
48
+ "lat": $latitude, # stop latitude
49
+ "lng": $longitude # stop longitude
50
+ }
51
+ },
52
+ # …
53
+ ]
54
+ },
55
+ "content_type": "StationGuesserResponse",
56
+ "destination": {
57
+ "target": "",
58
+ "type": "Module"
59
+ },
60
+ "id": 1
61
+}
62
+----
63
+
64
+.Response example
65
+[source,json]
66
+----
67
+{
68
+ "content": {
69
+ "guesses": [
70
+ {
71
+ "id": "gb-great-britain_50-1-430G05308",
72
+ "name": "Tower Hill",
73
+ "pos": {
74
+ "lat": 52.534782,
75
+ "lng": -1.918755
76
+ }
77
+ },
78
+ {
79
+ "id": "gb-northern-ireland_51-49-700000008267",
80
+ "name": "Tower Hill",
81
+ "pos": {
82
+ "lat": 54.352318,
83
+ "lng": -6.645357
84
+ }
85
+ },
86
+ {
87
+ "id": "gb-great-britain_50-1-227G00091138",
88
+ "name": "Tower Hill",
89
+ "pos": {
90
+ "lat": 53.48921,
91
+ "lng": -0.856088
92
+ }
93
+ },
94
+ {
95
+ "id": "gb-great-britain_50-1-400G4407356A",
96
+ "name": "Tower Hill",
97
+ "pos": {
98
+ "lat": 51.217354,
99
+ "lng": -0.448421
100
+ }
101
+ },
102
+ {
103
+ "id": "gb-great-britain_50-1-390G70148",
104
+ "name": "Tower Hill",
105
+ "pos": {
106
+ "lat": 52.44609,
107
+ "lng": 1.568928
108
+ }
109
+ },
110
+ {
111
+ "id": "gb-great-britain_50-1-2400A030890A",
112
+ "name": "Tower Hill",
113
+ "pos": {
114
+ "lat": 51.29039,
115
+ "lng": 0.377833
116
+ }
117
+ }
118
+ ]
119
+ },
120
+ "content_type": "StationGuesserResponse",
121
+ "destination": {
122
+ "target": "",
123
+ "type": "Module"
124
+ },
125
+ "id": 1
126
+}
127
+----
128
+
129
+=== Stops nearby
130
+
131
+.Request documentation
132
+[source,json]
133
+----
134
+{
135
+ "destination": {
136
+ "type": "Module",
137
+ "target": "/lookup/geo_station"
138
+ }
139
+ "content_type": "LookupGeoStationRequest",
140
+ "content": {
141
+ "max_radius": $radius, # radius from centre in metres
142
+ "pos": {
143
+ "lat": $latitude, # latitude of the centre
144
+ "lng": $longitude # longitude of the centre
145
+ }
146
+ }
147
+}
148
+----
149
+
150
+.Request example
151
+[source,sh]
152
+----
153
+curl 'https://routing.spline.de/api/' \
154
+ -H 'content-type: application/json' \
155
+ --data-raw '{"destination":{"type":"Module","target":"/lookup/geo_station"},"content_type":"LookupGeoStationRequest","content":{"max_radius":1000,"pos":{"lat":52.412, "lng":16.894}}}'
156
+----
157
+
158
+.Response documentation
159
+[source,json]
160
+----
161
+{
162
+ "content": {
163
+ "stations": [
164
+ {
165
+ "id": "$stopID", # stop ID
166
+ "name": "$stopName", # stop name
167
+ "pos": {
168
+ "lat": $latitude, # stop latitude
169
+ "lng": $longitude # stop longitude
170
+ }
171
+ },
172
+ # …
173
+ ]
174
+ },
175
+ "content_type": "LookupGeoStationResponse",
176
+ "destination": {
177
+ "target": "",
178
+ "type": "Module"
179
+ },
180
+ "id": 1
181
+}
182
+----
183
+
184
+.Response example
185
+[source,json]
186
+----
187
+{
188
+ "content": {
189
+ "stations": [
190
+ {
191
+ "id": "pl-Poznań_62",
192
+ "name": "Polna",
193
+ "pos": {
194
+ "lat": 52.41424,
195
+ "lng": 16.896698
196
+ }
197
+ },
198
+ {
199
+ "id": "pl-Poznań_63",
200
+ "name": "Polna",
201
+ "pos": {
202
+ "lat": 52.414215,
203
+ "lng": 16.897202
204
+ }
205
+ },
206
+ {
207
+ "id": "pl-Poznań_755",
208
+ "name": "Polna Szpital",
209
+ "pos": {
210
+ "lat": 52.409008,
211
+ "lng": 16.893578
212
+ }
213
+ },
214
+ {
215
+ "id": "pl-Poznań_1452",
216
+ "name": "Żeromskiego",
217
+ "pos": {
218
+ "lat": 52.414555,
219
+ "lng": 16.890738
220
+ }
221
+ },
222
+ {
223
+ "id": "pl-Poznań_756",
224
+ "name": "Polna Szpital",
225
+ "pos": {
226
+ "lat": 52.409225,
227
+ "lng": 16.890743
228
+ }
229
+ },
230
+ {
231
+ "id": "pl-Poznań_67",
232
+ "name": "Bukowska",
233
+ "pos": {
234
+ "lat": 52.410053,
235
+ "lng": 16.888826
236
+ }
237
+ },
238
+ {
239
+ "id": "pl-Poznań_66",
240
+ "name": "Bukowska",
241
+ "pos": {
242
+ "lat": 52.41,
243
+ "lng": 16.888638
244
+ }
245
+ },
246
+ {
247
+ "id": "pl-Poznań_60",
248
+ "name": "Żeromskiego",
249
+ "pos": {
250
+ "lat": 52.415543,
251
+ "lng": 16.890825
252
+ }
253
+ },
254
+ {
255
+ "id": "pl-Poznań_1450",
256
+ "name": "Żeromskiego",
257
+ "pos": {
258
+ "lat": 52.416077,
259
+ "lng": 16.89216
260
+ }
261
+ },
262
+ {
263
+ "id": "pl-Poznań_61",
264
+ "name": "Żeromskiego",
265
+ "pos": {
266
+ "lat": 52.41574,
267
+ "lng": 16.890362
268
+ }
269
+ },
270
+ {
271
+ "id": "pl-Poznań_758",
272
+ "name": "Bukowska",
273
+ "pos": {
274
+ "lat": 52.409256,
275
+ "lng": 16.888174
276
+ }
277
+ },
278
+ {
279
+ "id": "pl-Poznań_752",
280
+ "name": "Szylinga",
281
+ "pos": {
282
+ "lat": 52.408333,
283
+ "lng": 16.89875
284
+ }
285
+ },
286
+ {
287
+ "id": "pl-Poznań_1451",
288
+ "name": "Żeromskiego",
289
+ "pos": {
290
+ "lat": 52.416557,
291
+ "lng": 16.891827
292
+ }
293
+ },
294
+ {
295
+ "id": "pl-Poznań_759",
296
+ "name": "Grodziska",
297
+ "pos": {
298
+ "lat": 52.410072,
299
+ "lng": 16.88585
300
+ }
301
+ },
302
+ {
303
+ "id": "pl-Poznań_751",
304
+ "name": "Szylinga",
305
+ "pos": {
306
+ "lat": 52.407883,
307
+ "lng": 16.900095
308
+ }
309
+ },
310
+ {
311
+ "id": "pl-Poznań_754",
312
+ "name": "Kraszewskiego",
313
+ "pos": {
314
+ "lat": 52.408916,
315
+ "lng": 16.901783
316
+ }
317
+ },
318
+ {
319
+ "id": "pl-Poznań_760",
320
+ "name": "Grodziska",
321
+ "pos": {
322
+ "lat": 52.410122,
323
+ "lng": 16.884207
324
+ }
325
+ },
326
+ {
327
+ "id": "pl-Poznań_1463",
328
+ "name": "Kościelna",
329
+ "pos": {
330
+ "lat": 52.413483,
331
+ "lng": 16.904005
332
+ }
333
+ },
334
+ {
335
+ "id": "pl-Poznań_65",
336
+ "name": "Rynek Jeżycki",
337
+ "pos": {
338
+ "lat": 52.412537,
339
+ "lng": 16.90477
340
+ }
341
+ },
342
+ {
343
+ "id": "pl-Poznań_4272",
344
+ "name": "Kraszewskiego",
345
+ "pos": {
346
+ "lat": 52.40773,
347
+ "lng": 16.902296
348
+ }
349
+ },
350
+ {
351
+ "id": "pl-Poznań_1464",
352
+ "name": "Kościelna",
353
+ "pos": {
354
+ "lat": 52.41357,
355
+ "lng": 16.904663
356
+ }
357
+ },
358
+ {
359
+ "id": "pl-Poznań_64",
360
+ "name": "Rynek Jeżycki",
361
+ "pos": {
362
+ "lat": 52.412224,
363
+ "lng": 16.905642
364
+ }
365
+ },
366
+ {
367
+ "id": "pl-Poznań_748",
368
+ "name": "Matejki",
369
+ "pos": {
370
+ "lat": 52.40627,
371
+ "lng": 16.900963
372
+ }
373
+ },
374
+ {
375
+ "id": "pl-Poznań_622",
376
+ "name": "Ogrody",
377
+ "pos": {
378
+ "lat": 52.416683,
379
+ "lng": 16.885157
380
+ }
381
+ },
382
+ {
383
+ "id": "pl-Poznań_83",
384
+ "name": "Matejki",
385
+ "pos": {
386
+ "lat": 52.40579,
387
+ "lng": 16.900932
388
+ }
389
+ },
390
+ {
391
+ "id": "pl-Poznań_750",
392
+ "name": "Matejki",
393
+ "pos": {
394
+ "lat": 52.405228,
395
+ "lng": 16.899405
396
+ }
397
+ },
398
+ {
399
+ "id": "pl-Poznań_4032",
400
+ "name": "Niestachowska",
401
+ "pos": {
402
+ "lat": 52.41986,
403
+ "lng": 16.894829
404
+ }
405
+ },
406
+ {
407
+ "id": "pl-Poznań_749",
408
+ "name": "Matejki",
409
+ "pos": {
410
+ "lat": 52.40486,
411
+ "lng": 16.899946
412
+ }
413
+ },
414
+ {
415
+ "id": "pl-Poznań_4033",
416
+ "name": "Niestachowska",
417
+ "pos": {
418
+ "lat": 52.420006,
419
+ "lng": 16.894829
420
+ }
421
+ },
422
+ {
423
+ "id": "pl-Poznań_59",
424
+ "name": "Ogrody",
425
+ "pos": {
426
+ "lat": 52.416363,
427
+ "lng": 16.882902
428
+ }
429
+ },
430
+ {
431
+ "id": "pl-Poznań_769",
432
+ "name": "Opalenicka",
433
+ "pos": {
434
+ "lat": 52.404903,
435
+ "lng": 16.88735
436
+ }
437
+ },
438
+ {
439
+ "id": "pl-Poznań_770",
440
+ "name": "Opalenicka",
441
+ "pos": {
442
+ "lat": 52.40478,
443
+ "lng": 16.887516
444
+ }
445
+ },
446
+ {
447
+ "id": "pl-Poznań_1465",
448
+ "name": "Jeżycka",
449
+ "pos": {
450
+ "lat": 52.416206,
451
+ "lng": 16.90584
452
+ }
453
+ },
454
+ {
455
+ "id": "pl-Poznań_4030",
456
+ "name": "Św. Wawrzyńca",
457
+ "pos": {
458
+ "lat": 52.418835,
459
+ "lng": 16.901928
460
+ }
461
+ },
462
+ {
463
+ "id": "pl-Poznań_627",
464
+ "name": "Szpitalna",
465
+ "pos": {
466
+ "lat": 52.410828,
467
+ "lng": 16.880344
468
+ }
469
+ },
470
+ {
471
+ "id": "pl-Poznań_4031",
472
+ "name": "Św. Wawrzyńca",
473
+ "pos": {
474
+ "lat": 52.41869,
475
+ "lng": 16.90268
476
+ }
477
+ },
478
+ {
479
+ "id": "pl-Poznań_72",
480
+ "name": "Wojskowa",
481
+ "pos": {
482
+ "lat": 52.40341,
483
+ "lng": 16.892479
484
+ }
485
+ },
486
+ {
487
+ "id": "pl-Poznań_58",
488
+ "name": "Ogrody",
489
+ "pos": {
490
+ "lat": 52.417053,
491
+ "lng": 16.882463
492
+ }
493
+ },
494
+ {
495
+ "id": "pl-Poznań_621",
496
+ "name": "Ogrody",
497
+ "pos": {
498
+ "lat": 52.416927,
499
+ "lng": 16.882246
500
+ }
501
+ },
502
+ {
503
+ "id": "pl-Poznań_4079",
504
+ "name": "Ogrody",
505
+ "pos": {
506
+ "lat": 52.416294,
507
+ "lng": 16.881414
508
+ }
509
+ },
510
+ {
511
+ "id": "pl-Poznań_620",
512
+ "name": "Ogrody",
513
+ "pos": {
514
+ "lat": 52.41691,
515
+ "lng": 16.88181
516
+ }
517
+ }
518
+ ]
519
+ },
520
+ "content_type": "LookupGeoStationResponse",
521
+ "destination": {
522
+ "target": "",
523
+ "type": "Module"
524
+ },
525
+ "id": 1
526
+}
527
+----
528
+
529
+=== Departures for single stop
530
+
531
+.Request documentation
532
+[source,json]
533
+----
534
+{
535
+ "destination": {
536
+ "type": "Module",
537
+ "target": "/railviz/get_station"
538
+ },
539
+ "content_type": "RailVizStationRequest",
540
+ "content": {
541
+ "station_id": "$stopID", # stop ID
542
+ "time" $timestamp, # UNIX timestamp
543
+ "event_count": $count, # how many departures to return
544
+ "direction": "$direction", # LATER or BOTH or EARLIER; meaning unknown, possibly in relation to the time paramer
545
+ "by_schedule_time": $byScheduleTime # boolean; meaning unknown
546
+ }
547
+}
548
+----
549
+
550
+.Request example
551
+[source,sh]
552
+----
553
+curl 'https://routing.spline.de/api/' \
554
+ -H 'content-type: application/json' \
555
+ --data-raw '{"destination":{"type":"Module","target":"/railviz/get_station"},"content_type":"RailVizStationRequest","content":{"station_id":"pl-Poznań_62","time": 1726744921, "event_count": 1, "direction": "LATER", "by_schedule_time": true}}'
556
+----
557
+
558
+.Response documentation
559
+[source,json]
560
+----
561
+{
562
+ "content": {
563
+ "events": [
564
+ {
565
+ "event": {
566
+ "reason": "$reason", # enum describing time source (https://motis-project.de/docs/api/connection.html#reason)
567
+ "schedule_time": $scheduleTime, # schedule UNIX timestamp of the event
568
+ "schedule_track": "$scheduleTrack", # rail track of the event in schedule
569
+ "time": $time, # effective UNIX timestamp of the event
570
+ "track": "$track", # effective rail track of the event
571
+ "valid": $valid # boolean flag; false for departures from final terminus and arrivals to initial terminus
572
+ },
573
+ "trips": [
574
+ {
575
+ "id": { # https://motis-project.de/docs/api/buildingblocks.html#trip-id
576
+ "id": "$tripID", # trips ID
577
+ "line_id": "$lineID", # line ID
578
+ "station_id": "$stopID", # stop ID
579
+ "target_station_id": "$finalTerminusID", # final terminus stop ID
580
+ "target_time": $targetTime, # UNIX timestamp of the arrival at the destination
581
+ "time": $firstTime, # first departure time
582
+ "train_nr": $trainNumber # unique train number at the first departure
583
+ },
584
+ "transport": {
585
+ "clasz": $lineType, # line type (https://motis-project.de/docs/api/connection.html#clasz-type-integer)
586
+ "direction": "$lineHeadsign", # direction of the vehicle
587
+ "line_id": "$lineID", # line ID
588
+ "name": "$lineName", # line name
589
+ "provider": "$operatorName", # operator name
590
+ "provider_url": "$operatorWebsite", # operator website
591
+ "range": { # range of stops indices to which the information applies
592
+ "from": 0,
593
+ "to": 0
594
+ },
595
+ "route_color": "$lineColour" # line colour
596
+ }
597
+ }
598
+ ],
599
+ "type": "$eventType" # ARR or DEP; there are always two events for one requested
600
+ }
601
+ ],
602
+ "station": {
603
+ "id": "$stationID", # station ID (different from stop ID)
604
+ "name": "$stopName", # station name
605
+ "pos": {
606
+ "lat": $latitude, # stop latitude
607
+ "lng": $longitude # stop longitude
608
+ }
609
+ }
610
+ },
611
+ "content_type": "RailVizStationResponse",
612
+ "destination": {
613
+ "target": "",
614
+ "type": "Module"
615
+ },
616
+ "id": 1
617
+}
618
+----
619
+
620
+.Response example
621
+[source,json]
622
+----
623
+{
624
+ "content": {
625
+ "events": [
626
+ {
627
+ "event": {
628
+ "reason": "SCHEDULE",
629
+ "schedule_time": 1726744920,
630
+ "schedule_track": "",
631
+ "time": 1726744920,
632
+ "track": "",
633
+ "valid": true
634
+ },
635
+ "trips": [
636
+ {
637
+ "id": {
638
+ "id": "pl-Poznań_1_5486280^N+",
639
+ "line_id": "2",
640
+ "station_id": "pl-Poznań_193",
641
+ "target_station_id": "pl-Poznań_58",
642
+ "target_time": 1726745160,
643
+ "time": 1726743060,
644
+ "train_nr": 0
645
+ },
646
+ "transport": {
647
+ "clasz": 9,
648
+ "direction": "Ogrody",
649
+ "line_id": "2",
650
+ "name": "Tram 2",
651
+ "provider": "Miejskie Przedsiębiorstwo Komunikacyjne Sp. z o.o. w Poznaniu",
652
+ "provider_url": "http://www.mpk.poznan.pl",
653
+ "range": {
654
+ "from": 0,
655
+ "to": 0
656
+ },
657
+ "route_color": "72c4e7"
658
+ }
659
+ }
660
+ ],
661
+ "type": "DEP"
662
+ },
663
+ {
664
+ "event": {
665
+ "reason": "SCHEDULE",
666
+ "schedule_time": 1726744920,
667
+ "schedule_track": "",
668
+ "time": 1726744920,
669
+ "track": "",
670
+ "valid": true
671
+ },
672
+ "trips": [
673
+ {
674
+ "id": {
675
+ "id": "pl-Poznań_1_5486280^N+",
676
+ "line_id": "2",
677
+ "station_id": "pl-Poznań_193",
678
+ "target_station_id": "pl-Poznań_58",
679
+ "target_time": 1726745160,
680
+ "time": 1726743060,
681
+ "train_nr": 0
682
+ },
683
+ "transport": {
684
+ "clasz": 9,
685
+ "direction": "Ogrody",
686
+ "line_id": "2",
687
+ "name": "Tram 2",
688
+ "provider": "Miejskie Przedsiębiorstwo Komunikacyjne Sp. z o.o. w Poznaniu",
689
+ "provider_url": "http://www.mpk.poznan.pl",
690
+ "range": {
691
+ "from": 0,
692
+ "to": 0
693
+ },
694
+ "route_color": "72c4e7"
695
+ }
696
+ }
697
+ ],
698
+ "type": "ARR"
699
+ }
700
+ ],
701
+ "station": {
702
+ "id": "62",
703
+ "name": "Polna",
704
+ "pos": {
705
+ "lat": 52.41424,
706
+ "lng": 16.896698
707
+ }
708
+ }
709
+ },
710
+ "content_type": "RailVizStationResponse",
711
+ "destination": {
712
+ "target": "",
713
+ "type": "Module"
714
+ },
715
+ "id": 1
716
+}
717
+----
718
+
719
+
720
+=== Get vehicles on map
721
+
722
+.Request documentation
723
+[source,json]
724
+----
725
+{
726
+ "destination": {
727
+ "type": "Module",
728
+ "target": "/railviz/get_trains"
729
+ },
730
+ "content_type": "RailVizTrainsRequest",
731
+ "content": {
732
+ "zoom_bounds": $zoomBounds # integer; meaning unknown
733
+ "zoom_geo": $zoomGeo # integer; meaning unknown
734
+ "corner1": { # which corner is which, and does it matter?
735
+ "lat": $latitude, # corner latitude
736
+ "lng": $longitude # corner longitude
737
+ }
738
+ "corner2": {
739
+ "lat": $latitude, # corner latitude
740
+ "lng": $longitude # corner longitude
741
+ }
742
+ "max_trains": $maxTrains # integer; probably max number of results
743
+ "last_trains": $lastTrain # integer; meaning unknown
744
+ "start_time": $startTime # integer; meaning unknown
745
+ "end_time": $endTime # integer; meaning unknown
746
+ }
747
+}
748
+----
749
+
750
+Response doesn't include vehicle positions. They must probably be interpolated from last and next stops