Digital Compass identifying direction of travel for use with trains
This could be very easily prototyped in it's entirety with a smartphone - you have the sensor, the programmable platform, and the radio network link.  

Doing it that way with cheap off the shelf hardware matching a widespread developer skillset will let you explore the idea and start to discover what unanticipated issues might be lurking. 

For example, you haven' been very clear about when the measurement will be taken.  If the train is still in the station, it's possible the station tracks aren't really pointing in the direction of the journey.  A solution based on data pulled out of your scheduling system should be weighed as well.