mapbox / nepomuk

A public transit router for GTFS feeds (currently only static) written in modern c++
MIT License
24 stars 8 forks source link

Filter starting stops by line #107

Open MoKob opened 7 years ago

MoKob commented 7 years ago

station

When selecting a location on the map (symbolised by the black cross), appropriate starting locations are within a certain walking radius around the position (gold circle).

It is rather likely that we will have to allow for rather long walking segments (a few minutes) at origin and destination. It is possible for a line to have multiple stops in that region. In general, we shouldn't suggest walking to a far away station of the same line. But we don't want to consider all possible locations as source/target.

In this effort, we should filter all results we can request from a coordinate to stop look-up to keep a single stop per line. I.e. the closest one.

To implement this, we can go through the set of stops and keep a set of the lines we have seen so far. For every stop we check the lines departing at it. If any line is not in the set of known lines, we consider the stop an addition to our set. Else, we discard the stop as duplication. In our example from the beginning, this would be the red line.

The filter would need access to the lines per stop (stop-to-line lookup) and work on the results of the coordinate-to-stop lookup.