CUTR-at-USF / gtfsrdb

GTFSrDB is a tool to archive gtfs-realtime data to a database.
Other
38 stars 13 forks source link

Store timestamp of each VehiclePosition entity #12

Open answerquest opened 5 years ago

answerquest commented 5 years ago

Ref: https://github.com/google/transit/blob/master/gtfs-realtime/spec/en/reference.md#message-vehicleposition

There is a 'timestamp' field in each entity in a VehiclePositions feed in addition to the feed's timestamp. It records the moment at which the vehicle's position was measured.

This value is important - because it's possible for the feed to be carrying older positions. In analysis of archives, measuring the latency (time difference between feed time and vehicle time) can be important. It would be great if gtfsrdb can make a column and store this value as well in the vehicle_positions table.

Present creation statement in the sqlite db:

CREATE TABLE vehicle_positions ( oid INTEGER NOT NULL, trip_id VARCHAR(64), route_id VARCHAR(64), trip_start_time VARCHAR(8), trip_start_date VARCHAR(10), vehicle_id VARCHAR(10), vehicle_label VARCHAR(255), vehicle_license_plate VARCHAR(10), position_latitude FLOAT, position_longitude FLOAT, position_bearing FLOAT, position_speed FLOAT, occupancy_status VARCHAR(27), timestamp DATETIME, PRIMARY KEY (oid) )
barbeau commented 5 years ago

+1 for this feature - it's really important when trying to generate predictions from vehicle positions as well.

We're not currently actively working on this project but PRs accepted!