Ah, we're talking about practical solutions here? Should've warned me. A chain of laser reflective sensors might be even better, because there is less mechanical wear + you can use them to know where the train currently is and where it isn't.
But this is very likely a very well researched area and there are definitly train people who can point out a flaw in this idea (dirt?)
But this is very likely a very well researched area and there are definitly train people who can point out a flaw in this idea (dirt?)