GTFS Application Notes: stops

A parent station is associated with several stops. Note that there is no one-to-one correspondence between stop_name and stop_id.

1. Parent stations and stops

All the information about stops is placed in the file called stops.txt. Refer to General Transit Feed Specification Reference: stops_fields for the detailed description. Here is part of stops.txt from Toulouse Tisséo.

stop_id,stop_code,stop_name,stop_lat,stop_lon,location_type,parent_station,wheelchair_boarding
3377699720880573,2211,Ecole Croix-Rouge,43.6052,1.38701,0,1970324837184593,2
3377699720880577,4530,Matabiau Gare SNCF,43.611,1.45316,0,1970324840530381,1

A parent station is a physical structure or area that contains one or more stops. It makes sense that several stops (such as tram, subway, bus) are located in a same station named parent_station in GTFS. For instance, the Arènes station in Toulouse:


Fig. 1 The Arènes station in Toulouse

A one-to-many relationship exists between parent_station and stop. Here is an example to fully demonstrate it.

mysql> SET @parent_station='1970324837184714';  -- Arènes
mysql> SELECT stop_id,stop_code,location_type, stop_name,parent_station FROM stops WHERE stops.parent_station=@parent_station OR stop_id=@parent_station;
+------------------+-----------+---------------+-----------+------------------+
| stop_id          | stop_code | location_type | stop_name | parent_station   |
+------------------+-----------+---------------+-----------+------------------+
| 1970324837184714 |           |             1 | Arènes    |                  |
| 3377699720880799 | 180       |             0 | Arènes    | 1970324837184714 |
| 3377699720880801 | 185       |             0 | Arènes    | 1970324837184714 |
| 3377699720880802 | 184       |             0 | Arènes    | 1970324837184714 |
| 3377699720880803 | 183       |             0 | Arènes    | 1970324837184714 |
| 3377699720880805 | 188       |             0 | Arènes    | 1970324837184714 |
| 3377699720880806 | 189       |             0 | Arènes    | 1970324837184714 |
| 3377699720880808 | 40071     |             0 | Arènes    | 1970324837184714 |
| 3377699720880809 | 40070     |             0 | Arènes    | 1970324837184714 |
| 3377699722770341 | 60001     |             0 | Arènes    | 1970324837184714 |
| 3377699723347641 | 181|2693  |             0 | Arènes    | 1970324837184714 |
| 3377699723478058 | 60002     |             0 | Arènes    | 1970324837184714 |
| 3377704015495711 | 182       |             0 | Arènes    | 1970324837184714 |
| 3377704015496317 | 179       |             0 | Arènes    | 1970324837184714 |
+------------------+-----------+---------------+-----------+------------------+
14 rows in set (0,08 sec)

1.1 Get all parent stations

The field location_type distinguishes between a stop and a station. location_type=1 represents that a stop ID is a station. Therefore, to get all parent stations,

SELECT stop_id,stop_name,parent_station FROM stops WHERE location_type=1;

2. The stop name

Note that there is no one-to-one correspondence between stop_name and parent_station, not mention to stop_id.

mysql> SET @stop_name='Jean Jaurès';
mysql> SELECT *  FROM stops WHERE location_type=1 AND stop_name=@stop_name;
+------------------+-----------+--------------+-----------+----------+---------------+----------------+---------------------+-----------+---------+
| stop_id          | stop_code | stop_name    | stop_lat  | stop_lon | location_type | parent_station | wheelchair_boarding | stop_desc | zone_id |
+------------------+-----------+--------------+-----------+----------+---------------+----------------+---------------------+-----------+---------+
| 1970324837184810 |           | Jean Jaurès  | 43.606000 | 1.449190 |             1 |                |                   0 | NULL      | NULL    |
| 1970324837186360 |           | Jean Jaurès  | 43.506600 | 1.323770 |             1 |                |                   0 | NULL      | NULL    |
| 1970324837186389 |           | Jean Jaurès  | 43.677600 | 1.393330 |             1 |                |                   0 | NULL      | NULL    |
| 1970324839164152 |           | Jean Jaurès  | 43.669700 | 1.286390 |             1 |                |                   0 | NULL      | NULL    |
+------------------+-----------+--------------+-----------+----------+---------------+----------------+---------------------+-----------+---------+
4 rows in set (0,03 sec)

Label the above 4 points in Google Map and we have:

parent_stations_with_same_name
The position of 4 parent stations named ‘Jean Jaurès’

As we can see, stations with the same name might be located in different positions.

发表评论

电子邮件地址不会被公开。 必填项已用*标注