forked from R-OV-NL/GTFS-RT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gtfs-realtime.ts
2687 lines (2488 loc) · 86.2 KB
/
gtfs-realtime.ts
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
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* eslint-disable */
import * as _m0 from "protobufjs/minimal";
import Long = require("long");
export const protobufPackage = "transit_realtime";
/**
* The contents of a feed message.
* A feed is a continuous stream of feed messages. Each message in the stream is
* obtained as a response to an appropriate HTTP GET request.
* A realtime feed is always defined with relation to an existing GTFS feed.
* All the entity ids are resolved with respect to the GTFS feed.
*
* A feed depends on some external configuration:
* - The corresponding GTFS feed.
* - Feed application (updates, positions or alerts). A feed should contain only
* items of one specified application; all the other entities will be ignored.
* - Polling frequency
*/
export interface FeedMessage {
/** Metadata about this feed and feed message. */
header:
| FeedHeader
| undefined;
/** Contents of the feed. */
entity: FeedEntity[];
}
/** Metadata about a feed, included in feed messages. */
export interface FeedHeader {
/**
* Version of the feed specification.
* The current version is 1.0.
*/
gtfsRealtimeVersion: string;
incrementality: FeedHeader_Incrementality;
/**
* This timestamp identifies the moment when the content of this feed has been
* created (in server time). In POSIX time (i.e., number of seconds since
* January 1st 1970 00:00:00 UTC).
*/
timestamp: number;
}
/**
* Determines whether the current fetch is incremental. Currently,
* DIFFERENTIAL mode is unsupported and behavior is unspecified for feeds
* that use this mode. There are discussions on the GTFS-realtime mailing
* list around fully specifying the behavior of DIFFERENTIAL mode and the
* documentation will be updated when those discussions are finalized.
*/
export enum FeedHeader_Incrementality {
FULL_DATASET = 0,
DIFFERENTIAL = 1,
UNRECOGNIZED = -1,
}
export function feedHeader_IncrementalityFromJSON(object: any): FeedHeader_Incrementality {
switch (object) {
case 0:
case "FULL_DATASET":
return FeedHeader_Incrementality.FULL_DATASET;
case 1:
case "DIFFERENTIAL":
return FeedHeader_Incrementality.DIFFERENTIAL;
case -1:
case "UNRECOGNIZED":
default:
return FeedHeader_Incrementality.UNRECOGNIZED;
}
}
export function feedHeader_IncrementalityToJSON(object: FeedHeader_Incrementality): string {
switch (object) {
case FeedHeader_Incrementality.FULL_DATASET:
return "FULL_DATASET";
case FeedHeader_Incrementality.DIFFERENTIAL:
return "DIFFERENTIAL";
case FeedHeader_Incrementality.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** A definition (or update) of an entity in the transit feed. */
export interface FeedEntity {
/**
* The ids are used only to provide incrementality support. The id should be
* unique within a FeedMessage. Consequent FeedMessages may contain
* FeedEntities with the same id. In case of a DIFFERENTIAL update the new
* FeedEntity with some id will replace the old FeedEntity with the same id
* (or delete it - see is_deleted below).
* The actual GTFS entities (e.g. stations, routes, trips) referenced by the
* feed must be specified by explicit selectors (see EntitySelector below for
* more info).
*/
id: string;
/**
* Whether this entity is to be deleted. Relevant only for incremental
* fetches.
*/
isDeleted: boolean;
/**
* Data about the entity itself. Exactly one of the following fields must be
* present (unless the entity is being deleted).
*/
tripUpdate: TripUpdate | undefined;
vehicle: VehiclePosition | undefined;
alert: Alert | undefined;
}
/**
* Realtime update of the progress of a vehicle along a trip.
* Depending on the value of ScheduleRelationship, a TripUpdate can specify:
* - A trip that proceeds along the schedule.
* - A trip that proceeds along a route but has no fixed schedule.
* - A trip that have been added or removed with regard to schedule.
*
* The updates can be for future, predicted arrival/departure events, or for
* past events that already occurred.
* Normally, updates should get more precise and more certain (see
* uncertainty below) as the events gets closer to current time.
* Even if that is not possible, the information for past events should be
* precise and certain. In particular, if an update points to time in the past
* but its update's uncertainty is not 0, the client should conclude that the
* update is a (wrong) prediction and that the trip has not completed yet.
*
* Note that the update can describe a trip that is already completed.
* To this end, it is enough to provide an update for the last stop of the trip.
* If the time of that is in the past, the client will conclude from that that
* the whole trip is in the past (it is possible, although inconsequential, to
* also provide updates for preceding stops).
* This option is most relevant for a trip that has completed ahead of schedule,
* but according to the schedule, the trip is still proceeding at the current
* time. Removing the updates for this trip could make the client assume
* that the trip is still proceeding.
* Note that the feed provider is allowed, but not required, to purge past
* updates - this is one case where this would be practically useful.
*/
export interface TripUpdate {
/**
* The Trip that this message applies to. There can be at most one
* TripUpdate entity for each actual trip instance.
* If there is none, that means there is no prediction information available.
* It does *not* mean that the trip is progressing according to schedule.
*/
trip:
| TripDescriptor
| undefined;
/** Additional information on the vehicle that is serving this trip. */
vehicle:
| VehicleDescriptor
| undefined;
/**
* Updates to StopTimes for the trip (both future, i.e., predictions, and in
* some cases, past ones, i.e., those that already happened).
* The updates must be sorted by stop_sequence, and apply for all the
* following stops of the trip up to the next specified one.
*
* Example 1:
* For a trip with 20 stops, a StopTimeUpdate with arrival delay and departure
* delay of 0 for stop_sequence of the current stop means that the trip is
* exactly on time.
*
* Example 2:
* For the same trip instance, 3 StopTimeUpdates are provided:
* - delay of 5 min for stop_sequence 3
* - delay of 1 min for stop_sequence 8
* - delay of unspecified duration for stop_sequence 10
* This will be interpreted as:
* - stop_sequences 3,4,5,6,7 have delay of 5 min.
* - stop_sequences 8,9 have delay of 1 min.
* - stop_sequences 10,... have unknown delay.
*/
stopTimeUpdate: TripUpdate_StopTimeUpdate[];
/**
* Moment at which the vehicle's real-time progress was measured. In POSIX
* time (i.e., the number of seconds since January 1st 1970 00:00:00 UTC).
*/
timestamp: number;
/**
* The current schedule deviation for the trip. Delay should only be
* specified when the prediction is given relative to some existing schedule
* in GTFS.
*
* Delay (in seconds) can be positive (meaning that the vehicle is late) or
* negative (meaning that the vehicle is ahead of schedule). Delay of 0
* means that the vehicle is exactly on time.
*
* Delay information in StopTimeUpdates take precedent of trip-level delay
* information, such that trip-level delay is only propagated until the next
* stop along the trip with a StopTimeUpdate delay value specified.
*
* Feed providers are strongly encouraged to provide a TripUpdate.timestamp
* value indicating when the delay value was last updated, in order to
* evaluate the freshness of the data.
*
* NOTE: This field is still experimental, and subject to change. It may be
* formally adopted in the future.
*/
delay: number;
}
/**
* Timing information for a single predicted event (either arrival or
* departure).
* Timing consists of delay and/or estimated time, and uncertainty.
* - delay should be used when the prediction is given relative to some
* existing schedule in GTFS.
* - time should be given whether there is a predicted schedule or not. If
* both time and delay are specified, time will take precedence
* (although normally, time, if given for a scheduled trip, should be
* equal to scheduled time in GTFS + delay).
*
* Uncertainty applies equally to both time and delay.
* The uncertainty roughly specifies the expected error in true delay (but
* note, we don't yet define its precise statistical meaning). It's possible
* for the uncertainty to be 0, for example for trains that are driven under
* computer timing control.
*/
export interface TripUpdate_StopTimeEvent {
/**
* Delay (in seconds) can be positive (meaning that the vehicle is late) or
* negative (meaning that the vehicle is ahead of schedule). Delay of 0
* means that the vehicle is exactly on time.
*/
delay: number;
/**
* Event as absolute time.
* In Unix time (i.e., number of seconds since January 1st 1970 00:00:00
* UTC).
*/
time: number;
/**
* If uncertainty is omitted, it is interpreted as unknown.
* If the prediction is unknown or too uncertain, the delay (or time) field
* should be empty. In such case, the uncertainty field is ignored.
* To specify a completely certain prediction, set its uncertainty to 0.
*/
uncertainty: number;
}
/**
* Realtime update for arrival and/or departure events for a given stop on a
* trip. Updates can be supplied for both past and future events.
* The producer is allowed, although not required, to drop past events.
*/
export interface TripUpdate_StopTimeUpdate {
/** Must be the same as in stop_times.txt in the corresponding GTFS feed. */
stopSequence: number;
/** Must be the same as in stops.txt in the corresponding GTFS feed. */
stopId: string;
arrival: TripUpdate_StopTimeEvent | undefined;
departure: TripUpdate_StopTimeEvent | undefined;
scheduleRelationship: TripUpdate_StopTimeUpdate_ScheduleRelationship;
}
/** The relation between this StopTime and the static schedule. */
export enum TripUpdate_StopTimeUpdate_ScheduleRelationship {
/**
* SCHEDULED - The vehicle is proceeding in accordance with its static schedule of
* stops, although not necessarily according to the times of the schedule.
* At least one of arrival and departure must be provided. If the schedule
* for this stop contains both arrival and departure times then so must
* this update.
*/
SCHEDULED = 0,
/**
* SKIPPED - The stop is skipped, i.e., the vehicle will not stop at this stop.
* Arrival and departure are optional.
*/
SKIPPED = 1,
/**
* NO_DATA - No data is given for this stop. The main intention for this value is to
* give the predictions only for part of a trip, i.e., if the last update
* for a trip has a NO_DATA specifier, then StopTimes for the rest of the
* stops in the trip are considered to be unspecified as well.
* Neither arrival nor departure should be supplied.
*/
NO_DATA = 2,
UNRECOGNIZED = -1,
}
export function tripUpdate_StopTimeUpdate_ScheduleRelationshipFromJSON(
object: any,
): TripUpdate_StopTimeUpdate_ScheduleRelationship {
switch (object) {
case 0:
case "SCHEDULED":
return TripUpdate_StopTimeUpdate_ScheduleRelationship.SCHEDULED;
case 1:
case "SKIPPED":
return TripUpdate_StopTimeUpdate_ScheduleRelationship.SKIPPED;
case 2:
case "NO_DATA":
return TripUpdate_StopTimeUpdate_ScheduleRelationship.NO_DATA;
case -1:
case "UNRECOGNIZED":
default:
return TripUpdate_StopTimeUpdate_ScheduleRelationship.UNRECOGNIZED;
}
}
export function tripUpdate_StopTimeUpdate_ScheduleRelationshipToJSON(
object: TripUpdate_StopTimeUpdate_ScheduleRelationship,
): string {
switch (object) {
case TripUpdate_StopTimeUpdate_ScheduleRelationship.SCHEDULED:
return "SCHEDULED";
case TripUpdate_StopTimeUpdate_ScheduleRelationship.SKIPPED:
return "SKIPPED";
case TripUpdate_StopTimeUpdate_ScheduleRelationship.NO_DATA:
return "NO_DATA";
case TripUpdate_StopTimeUpdate_ScheduleRelationship.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** Realtime positioning information for a given vehicle. */
export interface VehiclePosition {
/**
* The Trip that this vehicle is serving.
* Can be empty or partial if the vehicle can not be identified with a given
* trip instance.
*/
trip:
| TripDescriptor
| undefined;
/** Additional information on the vehicle that is serving this trip. */
vehicle:
| VehicleDescriptor
| undefined;
/** Current position of this vehicle. */
position:
| Position
| undefined;
/**
* The stop sequence index of the current stop. The meaning of
* current_stop_sequence (i.e., the stop that it refers to) is determined by
* current_status.
* If current_status is missing IN_TRANSIT_TO is assumed.
*/
currentStopSequence: number;
/**
* Identifies the current stop. The value must be the same as in stops.txt in
* the corresponding GTFS feed.
*/
stopId: string;
/**
* The exact status of the vehicle with respect to the current stop.
* Ignored if current_stop_sequence is missing.
*/
currentStatus: VehiclePosition_VehicleStopStatus;
/**
* Moment at which the vehicle's position was measured. In POSIX time
* (i.e., number of seconds since January 1st 1970 00:00:00 UTC).
*/
timestamp: number;
congestionLevel: VehiclePosition_CongestionLevel;
occupancyStatus: VehiclePosition_OccupancyStatus;
}
export enum VehiclePosition_VehicleStopStatus {
/**
* INCOMING_AT - The vehicle is just about to arrive at the stop (on a stop
* display, the vehicle symbol typically flashes).
*/
INCOMING_AT = 0,
/** STOPPED_AT - The vehicle is standing at the stop. */
STOPPED_AT = 1,
/** IN_TRANSIT_TO - The vehicle has departed and is in transit to the next stop. */
IN_TRANSIT_TO = 2,
UNRECOGNIZED = -1,
}
export function vehiclePosition_VehicleStopStatusFromJSON(object: any): VehiclePosition_VehicleStopStatus {
switch (object) {
case 0:
case "INCOMING_AT":
return VehiclePosition_VehicleStopStatus.INCOMING_AT;
case 1:
case "STOPPED_AT":
return VehiclePosition_VehicleStopStatus.STOPPED_AT;
case 2:
case "IN_TRANSIT_TO":
return VehiclePosition_VehicleStopStatus.IN_TRANSIT_TO;
case -1:
case "UNRECOGNIZED":
default:
return VehiclePosition_VehicleStopStatus.UNRECOGNIZED;
}
}
export function vehiclePosition_VehicleStopStatusToJSON(object: VehiclePosition_VehicleStopStatus): string {
switch (object) {
case VehiclePosition_VehicleStopStatus.INCOMING_AT:
return "INCOMING_AT";
case VehiclePosition_VehicleStopStatus.STOPPED_AT:
return "STOPPED_AT";
case VehiclePosition_VehicleStopStatus.IN_TRANSIT_TO:
return "IN_TRANSIT_TO";
case VehiclePosition_VehicleStopStatus.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** Congestion level that is affecting this vehicle. */
export enum VehiclePosition_CongestionLevel {
UNKNOWN_CONGESTION_LEVEL = 0,
RUNNING_SMOOTHLY = 1,
STOP_AND_GO = 2,
CONGESTION = 3,
/** SEVERE_CONGESTION - People leaving their cars. */
SEVERE_CONGESTION = 4,
UNRECOGNIZED = -1,
}
export function vehiclePosition_CongestionLevelFromJSON(object: any): VehiclePosition_CongestionLevel {
switch (object) {
case 0:
case "UNKNOWN_CONGESTION_LEVEL":
return VehiclePosition_CongestionLevel.UNKNOWN_CONGESTION_LEVEL;
case 1:
case "RUNNING_SMOOTHLY":
return VehiclePosition_CongestionLevel.RUNNING_SMOOTHLY;
case 2:
case "STOP_AND_GO":
return VehiclePosition_CongestionLevel.STOP_AND_GO;
case 3:
case "CONGESTION":
return VehiclePosition_CongestionLevel.CONGESTION;
case 4:
case "SEVERE_CONGESTION":
return VehiclePosition_CongestionLevel.SEVERE_CONGESTION;
case -1:
case "UNRECOGNIZED":
default:
return VehiclePosition_CongestionLevel.UNRECOGNIZED;
}
}
export function vehiclePosition_CongestionLevelToJSON(object: VehiclePosition_CongestionLevel): string {
switch (object) {
case VehiclePosition_CongestionLevel.UNKNOWN_CONGESTION_LEVEL:
return "UNKNOWN_CONGESTION_LEVEL";
case VehiclePosition_CongestionLevel.RUNNING_SMOOTHLY:
return "RUNNING_SMOOTHLY";
case VehiclePosition_CongestionLevel.STOP_AND_GO:
return "STOP_AND_GO";
case VehiclePosition_CongestionLevel.CONGESTION:
return "CONGESTION";
case VehiclePosition_CongestionLevel.SEVERE_CONGESTION:
return "SEVERE_CONGESTION";
case VehiclePosition_CongestionLevel.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/**
* The degree of passenger occupancy of the vehicle. This field is still
* experimental, and subject to change. It may be formally adopted in the
* future.
*/
export enum VehiclePosition_OccupancyStatus {
/**
* EMPTY - The vehicle is considered empty by most measures, and has few or no
* passengers onboard, but is still accepting passengers.
*/
EMPTY = 0,
/**
* MANY_SEATS_AVAILABLE - The vehicle has a relatively large percentage of seats available.
* What percentage of free seats out of the total seats available is to be
* considered large enough to fall into this category is determined at the
* discretion of the producer.
*/
MANY_SEATS_AVAILABLE = 1,
/**
* FEW_SEATS_AVAILABLE - The vehicle has a relatively small percentage of seats available.
* What percentage of free seats out of the total seats available is to be
* considered small enough to fall into this category is determined at the
* discretion of the feed producer.
*/
FEW_SEATS_AVAILABLE = 2,
/** STANDING_ROOM_ONLY - The vehicle can currently accommodate only standing passengers. */
STANDING_ROOM_ONLY = 3,
/**
* CRUSHED_STANDING_ROOM_ONLY - The vehicle can currently accommodate only standing passengers
* and has limited space for them.
*/
CRUSHED_STANDING_ROOM_ONLY = 4,
/**
* FULL - The vehicle is considered full by most measures, but may still be
* allowing passengers to board.
*/
FULL = 5,
/** NOT_ACCEPTING_PASSENGERS - The vehicle is not accepting additional passengers. */
NOT_ACCEPTING_PASSENGERS = 6,
UNRECOGNIZED = -1,
}
export function vehiclePosition_OccupancyStatusFromJSON(object: any): VehiclePosition_OccupancyStatus {
switch (object) {
case 0:
case "EMPTY":
return VehiclePosition_OccupancyStatus.EMPTY;
case 1:
case "MANY_SEATS_AVAILABLE":
return VehiclePosition_OccupancyStatus.MANY_SEATS_AVAILABLE;
case 2:
case "FEW_SEATS_AVAILABLE":
return VehiclePosition_OccupancyStatus.FEW_SEATS_AVAILABLE;
case 3:
case "STANDING_ROOM_ONLY":
return VehiclePosition_OccupancyStatus.STANDING_ROOM_ONLY;
case 4:
case "CRUSHED_STANDING_ROOM_ONLY":
return VehiclePosition_OccupancyStatus.CRUSHED_STANDING_ROOM_ONLY;
case 5:
case "FULL":
return VehiclePosition_OccupancyStatus.FULL;
case 6:
case "NOT_ACCEPTING_PASSENGERS":
return VehiclePosition_OccupancyStatus.NOT_ACCEPTING_PASSENGERS;
case -1:
case "UNRECOGNIZED":
default:
return VehiclePosition_OccupancyStatus.UNRECOGNIZED;
}
}
export function vehiclePosition_OccupancyStatusToJSON(object: VehiclePosition_OccupancyStatus): string {
switch (object) {
case VehiclePosition_OccupancyStatus.EMPTY:
return "EMPTY";
case VehiclePosition_OccupancyStatus.MANY_SEATS_AVAILABLE:
return "MANY_SEATS_AVAILABLE";
case VehiclePosition_OccupancyStatus.FEW_SEATS_AVAILABLE:
return "FEW_SEATS_AVAILABLE";
case VehiclePosition_OccupancyStatus.STANDING_ROOM_ONLY:
return "STANDING_ROOM_ONLY";
case VehiclePosition_OccupancyStatus.CRUSHED_STANDING_ROOM_ONLY:
return "CRUSHED_STANDING_ROOM_ONLY";
case VehiclePosition_OccupancyStatus.FULL:
return "FULL";
case VehiclePosition_OccupancyStatus.NOT_ACCEPTING_PASSENGERS:
return "NOT_ACCEPTING_PASSENGERS";
case VehiclePosition_OccupancyStatus.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** An alert, indicating some sort of incident in the public transit network. */
export interface Alert {
/**
* Time when the alert should be shown to the user. If missing, the
* alert will be shown as long as it appears in the feed.
* If multiple ranges are given, the alert will be shown during all of them.
*/
activePeriod: TimeRange[];
/** Entities whose users we should notify of this alert. */
informedEntity: EntitySelector[];
cause: Alert_Cause;
effect: Alert_Effect;
/** The URL which provides additional information about the alert. */
url:
| TranslatedString
| undefined;
/** Alert header. Contains a short summary of the alert text as plain-text. */
headerText:
| TranslatedString
| undefined;
/**
* Full description for the alert as plain-text. The information in the
* description should add to the information of the header.
*/
descriptionText: TranslatedString | undefined;
}
/** Cause of this alert. */
export enum Alert_Cause {
UNKNOWN_CAUSE = 1,
/** OTHER_CAUSE - Not machine-representable. */
OTHER_CAUSE = 2,
TECHNICAL_PROBLEM = 3,
/** STRIKE - Public transit agency employees stopped working. */
STRIKE = 4,
/** DEMONSTRATION - People are blocking the streets. */
DEMONSTRATION = 5,
ACCIDENT = 6,
HOLIDAY = 7,
WEATHER = 8,
MAINTENANCE = 9,
CONSTRUCTION = 10,
POLICE_ACTIVITY = 11,
MEDICAL_EMERGENCY = 12,
UNRECOGNIZED = -1,
}
export function alert_CauseFromJSON(object: any): Alert_Cause {
switch (object) {
case 1:
case "UNKNOWN_CAUSE":
return Alert_Cause.UNKNOWN_CAUSE;
case 2:
case "OTHER_CAUSE":
return Alert_Cause.OTHER_CAUSE;
case 3:
case "TECHNICAL_PROBLEM":
return Alert_Cause.TECHNICAL_PROBLEM;
case 4:
case "STRIKE":
return Alert_Cause.STRIKE;
case 5:
case "DEMONSTRATION":
return Alert_Cause.DEMONSTRATION;
case 6:
case "ACCIDENT":
return Alert_Cause.ACCIDENT;
case 7:
case "HOLIDAY":
return Alert_Cause.HOLIDAY;
case 8:
case "WEATHER":
return Alert_Cause.WEATHER;
case 9:
case "MAINTENANCE":
return Alert_Cause.MAINTENANCE;
case 10:
case "CONSTRUCTION":
return Alert_Cause.CONSTRUCTION;
case 11:
case "POLICE_ACTIVITY":
return Alert_Cause.POLICE_ACTIVITY;
case 12:
case "MEDICAL_EMERGENCY":
return Alert_Cause.MEDICAL_EMERGENCY;
case -1:
case "UNRECOGNIZED":
default:
return Alert_Cause.UNRECOGNIZED;
}
}
export function alert_CauseToJSON(object: Alert_Cause): string {
switch (object) {
case Alert_Cause.UNKNOWN_CAUSE:
return "UNKNOWN_CAUSE";
case Alert_Cause.OTHER_CAUSE:
return "OTHER_CAUSE";
case Alert_Cause.TECHNICAL_PROBLEM:
return "TECHNICAL_PROBLEM";
case Alert_Cause.STRIKE:
return "STRIKE";
case Alert_Cause.DEMONSTRATION:
return "DEMONSTRATION";
case Alert_Cause.ACCIDENT:
return "ACCIDENT";
case Alert_Cause.HOLIDAY:
return "HOLIDAY";
case Alert_Cause.WEATHER:
return "WEATHER";
case Alert_Cause.MAINTENANCE:
return "MAINTENANCE";
case Alert_Cause.CONSTRUCTION:
return "CONSTRUCTION";
case Alert_Cause.POLICE_ACTIVITY:
return "POLICE_ACTIVITY";
case Alert_Cause.MEDICAL_EMERGENCY:
return "MEDICAL_EMERGENCY";
case Alert_Cause.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** What is the effect of this problem on the affected entity. */
export enum Alert_Effect {
NO_SERVICE = 1,
REDUCED_SERVICE = 2,
/**
* SIGNIFICANT_DELAYS - We don't care about INsignificant delays: they are hard to detect, have
* little impact on the user, and would clutter the results as they are too
* frequent.
*/
SIGNIFICANT_DELAYS = 3,
DETOUR = 4,
ADDITIONAL_SERVICE = 5,
MODIFIED_SERVICE = 6,
OTHER_EFFECT = 7,
UNKNOWN_EFFECT = 8,
STOP_MOVED = 9,
UNRECOGNIZED = -1,
}
export function alert_EffectFromJSON(object: any): Alert_Effect {
switch (object) {
case 1:
case "NO_SERVICE":
return Alert_Effect.NO_SERVICE;
case 2:
case "REDUCED_SERVICE":
return Alert_Effect.REDUCED_SERVICE;
case 3:
case "SIGNIFICANT_DELAYS":
return Alert_Effect.SIGNIFICANT_DELAYS;
case 4:
case "DETOUR":
return Alert_Effect.DETOUR;
case 5:
case "ADDITIONAL_SERVICE":
return Alert_Effect.ADDITIONAL_SERVICE;
case 6:
case "MODIFIED_SERVICE":
return Alert_Effect.MODIFIED_SERVICE;
case 7:
case "OTHER_EFFECT":
return Alert_Effect.OTHER_EFFECT;
case 8:
case "UNKNOWN_EFFECT":
return Alert_Effect.UNKNOWN_EFFECT;
case 9:
case "STOP_MOVED":
return Alert_Effect.STOP_MOVED;
case -1:
case "UNRECOGNIZED":
default:
return Alert_Effect.UNRECOGNIZED;
}
}
export function alert_EffectToJSON(object: Alert_Effect): string {
switch (object) {
case Alert_Effect.NO_SERVICE:
return "NO_SERVICE";
case Alert_Effect.REDUCED_SERVICE:
return "REDUCED_SERVICE";
case Alert_Effect.SIGNIFICANT_DELAYS:
return "SIGNIFICANT_DELAYS";
case Alert_Effect.DETOUR:
return "DETOUR";
case Alert_Effect.ADDITIONAL_SERVICE:
return "ADDITIONAL_SERVICE";
case Alert_Effect.MODIFIED_SERVICE:
return "MODIFIED_SERVICE";
case Alert_Effect.OTHER_EFFECT:
return "OTHER_EFFECT";
case Alert_Effect.UNKNOWN_EFFECT:
return "UNKNOWN_EFFECT";
case Alert_Effect.STOP_MOVED:
return "STOP_MOVED";
case Alert_Effect.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/**
* A time interval. The interval is considered active at time 't' if 't' is
* greater than or equal to the start time and less than the end time.
*/
export interface TimeRange {
/**
* Start time, in POSIX time (i.e., number of seconds since January 1st 1970
* 00:00:00 UTC).
* If missing, the interval starts at minus infinity.
*/
start: number;
/**
* End time, in POSIX time (i.e., number of seconds since January 1st 1970
* 00:00:00 UTC).
* If missing, the interval ends at plus infinity.
*/
end: number;
}
/** A position. */
export interface Position {
/** Degrees North, in the WGS-84 coordinate system. */
latitude: number;
/** Degrees East, in the WGS-84 coordinate system. */
longitude: number;
/**
* Bearing, in degrees, clockwise from North, i.e., 0 is North and 90 is East.
* This can be the compass bearing, or the direction towards the next stop
* or intermediate location.
* This should not be direction deduced from the sequence of previous
* positions, which can be computed from previous data.
*/
bearing: number;
/** Odometer value, in meters. */
odometer: number;
/** Momentary speed measured by the vehicle, in meters per second. */
speed: number;
}
/**
* A descriptor that identifies an instance of a GTFS trip, or all instances of
* a trip along a route.
* - To specify a single trip instance, the trip_id (and if necessary,
* start_time) is set. If route_id is also set, then it should be same as one
* that the given trip corresponds to.
* - To specify all the trips along a given route, only the route_id should be
* set. Note that if the trip_id is not known, then stop sequence ids in
* TripUpdate are not sufficient, and stop_ids must be provided as well. In
* addition, absolute arrival/departure times must be provided.
*/
export interface TripDescriptor {
/**
* The trip_id from the GTFS feed that this selector refers to.
* For non frequency-based trips, this field is enough to uniquely identify
* the trip. For frequency-based trip, start_time and start_date might also be
* necessary.
*/
tripId: string;
/** The route_id from the GTFS that this selector refers to. */
routeId: string;
/**
* The direction_id from the GTFS feed trips.txt file, indicating the
* direction of travel for trips this selector refers to. This field is
* still experimental, and subject to change. It may be formally adopted in
* the future.
*/
directionId: number;
/**
* The initially scheduled start time of this trip instance.
* When the trip_id corresponds to a non-frequency-based trip, this field
* should either be omitted or be equal to the value in the GTFS feed. When
* the trip_id correponds to a frequency-based trip, the start_time must be
* specified for trip updates and vehicle positions. If the trip corresponds
* to exact_times=1 GTFS record, then start_time must be some multiple
* (including zero) of headway_secs later than frequencies.txt start_time for
* the corresponding time period. If the trip corresponds to exact_times=0,
* then its start_time may be arbitrary, and is initially expected to be the
* first departure of the trip. Once established, the start_time of this
* frequency-based trip should be considered immutable, even if the first
* departure time changes -- that time change may instead be reflected in a
* StopTimeUpdate.
* Format and semantics of the field is same as that of
* GTFS/frequencies.txt/start_time, e.g., 11:15:35 or 25:15:35.
*/
startTime: string;
/**
* The scheduled start date of this trip instance.
* Must be provided to disambiguate trips that are so late as to collide with
* a scheduled trip on a next day. For example, for a train that departs 8:00
* and 20:00 every day, and is 12 hours late, there would be two distinct
* trips on the same time.
* This field can be provided but is not mandatory for schedules in which such
* collisions are impossible - for example, a service running on hourly
* schedule where a vehicle that is one hour late is not considered to be
* related to schedule anymore.
* In YYYYMMDD format.
*/
startDate: string;
scheduleRelationship: TripDescriptor_ScheduleRelationship;
}
/**
* The relation between this trip and the static schedule. If a trip is done
* in accordance with temporary schedule, not reflected in GTFS, then it
* shouldn't be marked as SCHEDULED, but likely as ADDED.
*/
export enum TripDescriptor_ScheduleRelationship {
/**
* SCHEDULED - Trip that is running in accordance with its GTFS schedule, or is close
* enough to the scheduled trip to be associated with it.
*/
SCHEDULED = 0,
/**
* ADDED - An extra trip that was added in addition to a running schedule, for
* example, to replace a broken vehicle or to respond to sudden passenger
* load.
*/
ADDED = 1,
/**
* UNSCHEDULED - A trip that is running with no schedule associated to it, for example, if
* there is no schedule at all.
*/
UNSCHEDULED = 2,
/** CANCELED - A trip that existed in the schedule but was removed. */
CANCELED = 3,
/** MODIFIED - Trip that is no longer running in accordance with its GTFS schedule and replaces it. */
MODIFIED = 5,
UNRECOGNIZED = -1,
}
export function tripDescriptor_ScheduleRelationshipFromJSON(object: any): TripDescriptor_ScheduleRelationship {
switch (object) {
case 0:
case "SCHEDULED":
return TripDescriptor_ScheduleRelationship.SCHEDULED;
case 1:
case "ADDED":
return TripDescriptor_ScheduleRelationship.ADDED;
case 2:
case "UNSCHEDULED":
return TripDescriptor_ScheduleRelationship.UNSCHEDULED;
case 3:
case "CANCELED":
return TripDescriptor_ScheduleRelationship.CANCELED;
case 5:
case "MODIFIED":
return TripDescriptor_ScheduleRelationship.MODIFIED;
case -1:
case "UNRECOGNIZED":
default:
return TripDescriptor_ScheduleRelationship.UNRECOGNIZED;
}
}
export function tripDescriptor_ScheduleRelationshipToJSON(object: TripDescriptor_ScheduleRelationship): string {
switch (object) {
case TripDescriptor_ScheduleRelationship.SCHEDULED:
return "SCHEDULED";
case TripDescriptor_ScheduleRelationship.ADDED:
return "ADDED";
case TripDescriptor_ScheduleRelationship.UNSCHEDULED:
return "UNSCHEDULED";
case TripDescriptor_ScheduleRelationship.CANCELED:
return "CANCELED";
case TripDescriptor_ScheduleRelationship.MODIFIED:
return "MODIFIED";
case TripDescriptor_ScheduleRelationship.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** Identification information for the vehicle performing the trip. */
export interface VehicleDescriptor {
/**
* Internal system identification of the vehicle. Should be unique per
* vehicle, and can be used for tracking the vehicle as it proceeds through
* the system.
*/
id: string;
/**
* User visible label, i.e., something that must be shown to the passenger to
* help identify the correct vehicle.
*/
label: string;
/** The license plate of the vehicle. */
licensePlate: string;
}
/** A selector for an entity in a GTFS feed. */
export interface EntitySelector {
/**
* The values of the fields should correspond to the appropriate fields in the
* GTFS feed.
* At least one specifier must be given. If several are given, then the
* matching has to apply to all the given specifiers.
*/
agencyId: string;
routeId: string;
/** corresponds to route_type in GTFS. */
routeType: number;
trip: TripDescriptor | undefined;
stopId: string;
}
/**
* An internationalized message containing per-language versions of a snippet of
* text or a URL.
* One of the strings from a message will be picked up. The resolution proceeds
* as follows:
* 1. If the UI language matches the language code of a translation,
* the first matching translation is picked.
* 2. If a default UI language (e.g., English) matches the language code of a
* translation, the first matching translation is picked.
* 3. If some translation has an unspecified language code, that translation is
* picked.
*/
export interface TranslatedString {
/** At least one translation must be provided. */
translation: TranslatedString_Translation[];
}
export interface TranslatedString_Translation {
/** A UTF-8 string containing the message. */
text: string;
/**
* BCP-47 language code. Can be omitted if the language is unknown or if
* no i18n is done at all for the feed. At most one translation is
* allowed to have an unspecified language tag.
*/
language: string;
}
function createBaseFeedMessage(): FeedMessage {
return { header: undefined, entity: [] };
}
export const FeedMessage = {
encode(message: FeedMessage, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.header !== undefined) {