Expand description
§Decoding and Encoding example GTFS data example
use prost::Message;
let url = "https://lbtgtfs.lbtransit.com/TMGTFSRealTimeWebService/Vehicle/VehiclePositions.pb";
let response = reqwest::get(url).await.unwrap();
let bytes = response.bytes().await.unwrap();
let data: Result<gtfs_realtime::FeedMessage, prost::DecodeError> = prost::Message::decode(bytes.as_ref());
let data = data.unwrap();
//encode back into protobuf
let rencoded = data.encode_to_vec();
Modules§
- alert
- Nested message and enum types in
Alert
. - feed_
header - Nested message and enum types in
FeedHeader
. - stop
- Nested message and enum types in
Stop
. - translated_
image - Nested message and enum types in
TranslatedImage
. - translated_
string - Nested message and enum types in
TranslatedString
. - trip_
descriptor - Nested message and enum types in
TripDescriptor
. - trip_
modifications - Nested message and enum types in
TripModifications
. - trip_
update - Nested message and enum types in
TripUpdate
. - vehicle_
descriptor - Nested message and enum types in
VehicleDescriptor
. - vehicle_
position - Nested message and enum types in
VehiclePosition
.
Structs§
- Alert
- An alert, indicating some sort of incident in the public transit network.
- Entity
Selector - A selector for an entity in a GTFS feed.
- Feed
Entity - A definition (or update) of an entity in the transit feed.
- Feed
Header - Metadata about a feed, included in feed messages.
- Feed
Message - 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. Note that “required” and “optional” as stated in this file refer to Protocol Buffer cardinality, not semantic cardinality. See reference.md at https://github.com/google/transit/tree/master/gtfs-realtime for field semantic cardinality.
- Position
- A position.
- Replacement
Stop - NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
- Shape
- Describes the physical path that a vehicle takes when it’s not part of the (CSV) GTFS, such as for a detour. Shapes belong to Trips, and consist of a sequence of shape points. Tracing the points in order provides the path of the vehicle. Shapes do not need to intercept the location of Stops exactly, but all Stops on a trip should lie within a small distance of the shape for that trip, i.e. close to straight line segments connecting the shape points NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future.
- Stop
- Describes a stop which is served by trips. All fields are as described in the GTFS-Static specification. NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future.
- Stop
Selector - NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. Select a stop by stop sequence or by stop_id. At least one of the two values must be provided.
- Time
Range - 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.
- Translated
Image - An internationalized image containing per-language versions of a URL linking to an image along with meta information Only one of the images from a message will be retained by consumers. The resolution proceeds as follows:
- Translated
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:
- Trip
Descriptor - A descriptor that identifies an instance of a GTFS trip, or all instances of a trip along a route.
- Trip
Modifications - NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
- Trip
Update - Realtime update of the progress of a vehicle along a trip. Depending on the value of ScheduleRelationship, a TripUpdate can specify:
- Vehicle
Descriptor - Identification information for the vehicle performing the trip.
- Vehicle
Position - Realtime positioning information for a given vehicle.