Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

CALCULATE SPEED WITH GTFS STATC

56 views
Skip to first unread message

Bwami Rupin

unread,
Dec 17, 2024, 11:03:04 AM12/17/24
to GTFS Changes
Dear Sir/Madam, 
I am working with GTFS STATIC data and am seeking to ascertain the speed based on distance and time using the R programming software. Despite attempting various methods, I have not yet achieved the desired results. Could you kindly advise on the best course of action? Would sharing my script be beneficial?

I am grateful for your assistance

Stephen Bauman

unread,
Dec 20, 2024, 11:49:04 AM12/20/24
to GTFS Changes
I'm starting with the assumption that you already know how to use the calendar, calendar_dates, trips,  and stop_times files to determine the trips of interest for your study period. I'm also assuming that you already know how to determine the time interval between scheduled stops. Your problem then reduces to determining the route distance between the stops.

If you are lucky, either the optional shapes.txt or stop_times.txt files contain the optional shape_dist_traveled field. This provides the missing distance parameter. 
You may have to convert the distance according to your location. This involves some GIS knowledge. I don't know whether R has this capability.

If the shape_dist_traveled field isn't present, getting the distance isn't difficult if the optional shapes.txt file is present.

You will have to convert the longitude/latitude point coordinates to local coordinates before summing up the individual point-to-point Euclidean distances.
A GIS package helps. I haven't used R, so I don't know how difficult this would be.

If the shapes.txt file isn't present, you are going to have to guess the route from the stop location, that is contained in the stops.txt file. 

I'm currently working on a project to do just that. I'm using Open Street Maps as the road network source. I don't know whether I'll be successful.

Hope this helps.

Bwami Rupin

unread,
Jan 6, 2025, 9:50:16 AMJan 6
to gtfs-c...@googlegroups.com
Thank you for your reply,
I don't have this distance column in both files. By the way, I want to know how to calculate the speed travelled by a set of bus lines I've chosen to analyze. When, for example, the time travelled between two stops was checked (by taking the arrival time at the next stop - the departure time from the previous stop), a negative time was found. 
What I'm asking is, do you have any precise documentation enabling me to solve this problem?

Please let me know

Translated with DeepL.com (free version)
Rupin BWAMI KAHOMBERA
Research and Teaching Assistant
Faculty of Economics and Management_UEA/BUKAVU

Advanced Master in Transport and Supply Chain Management
Ecole polytechnique de Bruxelles_ULB

PhD Student at the Faculty of Applied Sciences
Department of Urban and Environmental Engineering_ULiège



--
You received this message because you are subscribed to a topic in the Google Groups "GTFS Changes" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gtfs-changes/c429Foha3bs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gtfs-changes...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/gtfs-changes/400fb263-aabd-4201-ab18-a1f1463196abn%40googlegroups.com.

Stephen Bauman

unread,
Jan 9, 2025, 10:04:33 AMJan 9
to GTFS Changes
I've found python's gtfs-kit to be most helpful. 


I cannot help regarding your time problem, without looking at the particular instance. It's either a problem with your analysis or bad source data.

Here's a link to GTFS validators, that may point to bad data.


If the validator does not find any GTFS problem, then it's time to examine your analysis. There are plenty of suspects.

The most obvious is: are you using the stop_sequence field to determine which stop comes first and which comes next?

Steve
Reply all
Reply to author
Forward
0 new messages