afimb / gtfslib-python

An open source library in python for reading GTFS files and computing various stats and indicators about Public Transport networks
GNU General Public License v3.0
44 stars 6 forks source link

Expand transfers from station to sub-stop #22

Open laurentg opened 8 years ago

laurentg commented 8 years ago

(Extract from WIKI GTFS' model)

Proposal: expansion of transfers

In GTFS, a transfer that is defined for a station will apply, if not redefined, to all the station stops. A proposal to GTFS' is to expand any station transfer to sub-stops, if a transfer is not already redefined for the stops.

Goal: to provide for the API user an easy access of transfers between stops w/o having to check for transfers between stations. The check/load sequence can be rather complex (stop to stop, stop to station, station to stop, station to station...)

For example let's assume we have station A with stops A1 and A2, and station B with stops B1 and B2, and the following transfers:

from   to   type
A      B    0
A1     B1   3
B      A    1
B1     A    3

The transfer expansion process would expand to the following:

from   to   type   source
A      B    0      Original
A1     B1   3      Original
A1     B2   0      Expanded
A2     B1   0      Expanded
A2     B2   0      Expanded
B      A    1      Original
B1     A    3      Original
B1     A1   3      Expanded
B1     A2   3      Expanded
B2     A1   1      Expanded
B2     A2   1      Expanded
laurentg commented 8 years ago

This should be made optional as for some input data (many stations with many stops) the generated data can grow quite large.

laurentg commented 5 years ago

Another idea is to "generate" those virtual transfers at the DAO or service layer, with query functions that automatically generate missing transfers according to those expansion rules.