Reputation: 49
I am trying to make a website that can show a user the map of a route and the schedule for that day. The problem is that within the stop_times.txt file, it shows each stop time at each stop, but not which day it occurs. How would I be able to figure out which day a trip occurs?
For example, here is some data I have sorted:
trip_id,arrival_time,departure_time,stop_id,stop_sequence,stop_headsign,pickup_type,drop_off_type,shape_dist_traveled,timepoint
'16873083', '05:52:00', '05:52:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
'16873084', '06:23:00', '06:23:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
'16873085', '06:52:00', '06:52:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
...
'16873119', '23:44:00', '23:44:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
'16873120', '24:44:00', '24:44:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
'16873124', '06:36:00', '06:36:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
'16873125', '07:08:00', '07:08:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
'16873126', '16:11:00', '16:11:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
Then it repeats this once and then there are a bunch of different times for what I think is the weekend schedule:
'16861123', '05:43:00', '05:43:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
'16861124', '06:43:00', '06:43:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
'16861125', '07:43:00', '07:43:00', '9257', '31', '79 Century Park', '0', '0', '9535.3', '0'
...
I've separated the data from stop_times.txt into individual files for each stop. However, as you can see above, it would be very difficult to manually figure out what day each part of the file represents for over 6,000 stops/files.
Is there any way this could be done?
Upvotes: 0
Views: 685
Reputation: 314
As can be seen in the trip diagram the stop_times trip_id references the trips table. In the trips table the service_id references the calendar table which tells you on which days the trip runs between the specified start and end dates. This can be further tweaked by specifying exceptions such as public holidays in calendar_dates. For a complete understanding the spec at
https://developers.google.com/transit/gtfs/reference
should be read.
Upvotes: 2