Earlier quoted context omitted.
How about an RFID chip (costs nothing) on every sleeper. Little database and you know exactly where you are. Accurate a few centimeters
Or maybe a camera underneath the train? It could be the same kind of thing used in optical mice, or just count the sleepers
The spit up of grease, leaves, metal particulate from rail and wheel grind, etc gets pretty thick.
The vision challenge is to cheaply and effectively keep a clean lens.
There's a similar challenge in monitoring production conveyor belts in mineral processing - vibration, tempreture, rocks kick about, dust make for a savage environment.