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

Disused railway being wrongly used when computing shape #44

Closed BodoMinea closed 9 months ago

BodoMinea commented 1 year ago

Hi everyone,

I use pfaedle to add or improve shapes of GTFS feeds I consume or publish. It usually works really great and especially in-city map matching is flawless.

However, I have ran into a weird issue with a specific intercity railway route.

An inefficient and indirect shape which takes a disused railway and that would necessitate reversing the train is taken instead of a direct railway link, as you can see below:

Problem

route_type=2 (RAIL) (lat,lon) Stop 1 - 46.191443, 21.324782 Stop 2 - 45.75023, 21.203318

According to the default config at https://github.com/ad-freiburg/pfaedle/blob/45f508bf340f737b8f2f7920f6385ac630e3877c/pfaedle.cfg#L279, disused railway lines should be filtered out.

Any ideas on how to get around this issue?

Thanks.

patrickbr commented 9 months ago

Sorry for the extremely late reply. The problem in your case is that the railway=disused way is part of the following relation: https://www.openstreetmap.org/relation/12453029

As mentioned in the example pfaedle.cfg, :

Ways included in non-dropped relations are kept regardless of a matching drop filter.

The easiest solution in your case would be to drop route=rail from the osm_filter_keep section of [rail]. You could also try adding railway=disused to osm_filter_lvl5 to add a huge penalty during routing. However, I suspect that this has little effect because the disused part is so short.

The best solution would be to fix the correct train route (the one you expected) to Arad. Something may be wrong here, otherwise pfaedle would use this route.