geofabrik / OpenRailRouting

routing on railway tracks using OpenStreetMap data and the GraphHopper routing engine
Apache License 2.0
168 stars 30 forks source link

Map-matching on metro or subways #15

Closed mperacchi closed 3 months ago

mperacchi commented 5 years ago

Hi, I'm working on a personal project that involves tracking public transport and I'm trying to do map matching on OSM using your library. I've successfully managed to use the low level API calling them from command line and they work fine for trains, problem is that I'd like to do the same thing, but on trams, metro and subways. I've delved into the "FlagEncoders" and "RailFlagEncoders" and I think I've understood how they work, I'd like to implement a new one to include other means of transport on rail. Unfortunately I can't figure out how to specify the type of "way" (https://wiki.openstreetmap.org/wiki/Map_Features#Railway) to be used to perform the matching. Please feel free to ask any question if I haven't been clear enough, Thanks for the help.

EDIT: grammar

Nakaner commented 5 years ago

https://github.com/geofabrik/OpenRailRouting/blob/f28b9dd18542cd016ce65433030e691f66b44160/src/main/java/de/geofabrik/railway_routing/RailFlagEncoder.java#L153 decides which ways will make it into the graph.

One solution is to write another class derived from AbstractFlagEncoder. That would be the way one would do it for upstream GraphHopper. However, OpenRailRouting allows to parametrise the flag encoder using the configuration file. Currently speed limits, the number of bits to store the speed, voltages, gauges and a few other attributions are supported only. You could add a new configuration property railwayValues with a list of all types of railway=* from OSM.

One day I will do that when I feel the need to do routing for tram-trains but I am happy to accept pull requests on that.

joakimfors commented 3 years ago

This should do it #22

Nakaner commented 3 months ago

This issue was resolved.