Map Matching with Train Data

Given some GPS positions along a rail track, how could I do map matching for that given the assumption that the vehicle moves on the rails? I have seen [1] as a readable collection of vehicles implemented so far which are in the same directory, e.g. for a bike [2]. Is there anything else to consider? Have you heard of somebody who has already implemented such a thing?

[1] https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/util/FlagEncoderFactory.java
[2] https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/util/BikeFlagEncoder.java
[3] https://github.com/graphhopper/graphhopper/blob/master/reader-osm/src/main/java/com/graphhopper/reader/osm/OSMReader.java

Hi Murph,

I’m currently working on exactly the tool you’re describing, when a friend of mine showed me this grashopper routing-thing. Did you find a solution for the GPS-mapping that did fit your needs? If so, how did it work for you? did you maybe use GitHub - geofabrik/OpenRailRouting: routing on railway tracks using OpenStreetMap data and the GraphHopper routing engine?
Im still not sure, grashopper is the way to go for me, as we need detailed information on the track-kilometer numbers and OSM does not seem to have that from my point of view (but e.g. DB Inspire and does), but I would like to know how other people solved this GPS->Track problem.

Yours,
Julian