ad-freiburg / pfaedle

Precise map-matching for public transit feeds. Generates high-quality GTFS shapes from OSM data.
GNU General Public License v3.0
208 stars 29 forks source link

incorrect shape_dist_travelled #17

Closed RuiLoureiro closed 4 years ago

RuiLoureiro commented 4 years ago

First of all, thank you for your work. It is helping me a lot in my masters thesis.

This issue is related to #7. I'm trying to find the street point where a bus stops at a stop.

I'm doing what was recommended by @patrickbr in #7:

You can exactly encode where a trip comes to a stop on a shape by the value of shape_dist_traveled in stop_times.txt. pfaedle should correctly update the shape_dist_traveled value after map-matching, so you can very easily get the position on a shape where the vehicle stops at a station.

However, I'm not getting correct results. For example, the following plot shows the GTFS stop location (blue), the shape points (green) and the shape point with the closest shape_dist_traveled (red).

incorrect

This repository has the code used to generate the above plot (in a python jupyter notebook): https://github.com/RuiLoureiro/pfaedle_issue

Here's what I used:

Ran pfaedle inside the gtfs folder: pfaedle -D -x ../portugal-latest.osm .

Am I doing something wrong?

patrickbr commented 4 years ago

This is most likely because there is no station at your blue position in OSM: https://www.openstreetmap.org/search?query=estrada%20de%20a-da-maia#map=19/38.75210/-9.20601

pfaedle prefers positions for stations which are already mapped in OSM. To change this behaviour, you can try lowering the routing_non_osm_station_punish option in pfaedle.cfg (you can either edit the one that is installed to /usr/share/pfaedle, or create a new one in your home directory, or give the configuration file via the -c parameter).

For [bus], you could for example set

routing_non_osm_station_punish = 0
RuiLoureiro commented 4 years ago

That was it! Thank you