How to get stations name for each route?

61 views
Skip to first unread message

Xue lida

unread,
Mar 31, 2021, 4:22:27 AMMar 31
to mtadeveloperresources
Hello everyone,

          i just wanna to know how can i get station names for each route, now i get stop_id, it seems like an abbreviation, then how can i get more information through stop_id?

thanks!

sm12...@gmail.com

unread,
Mar 31, 2021, 4:54:27 PMMar 31
to mtadeveloperresources
I'll assume you are working with the GTFS static files.  Here's a link https://developers.google.com/transit/gtfs/reference to the reference that describes each file. If you read it carefully, you will note that the files form a relational database. This holds true for the subway and bus static data.

Your question is a bit off because stations are associated with trips not routes. Here's how I would go about answering your question.

First, based on the desired trip date, the calendar and calendar_dates files (tables) will supply a set of service_id's. 

These service_id's can be used to probe the trips file (table) to get a set of trips for the supplied service_id's. There are 2 items that are useful in the trips file: route_id and trip_id. The route_id refers an entry in the routes file. The route_id may be enough to limit your search, if you are interested in a specific route. You would use only the trip_id's of interest to proceed further. 

The trip_id's can be used to probe the stop_times file (table). This probe will provide a set of stop_id's for each trip (and by extension the route_id associated with it).

These stop_id's can then be used to probe the stops file (table). One of this table's columns is the stop_name, which I assume will answer your question. If you already had a list of the desired stop_id's, then you can skip the previous steps and use the stops file as a lookup table.

Reply all
Reply to author
Forward
0 new messages