It's 2014. Why don't tracks have sensors communicating with trains over radio waves?
It can take a train moving at 50 mph up to a mile to stop after the engineer pulls the emergency brake. If someone can see the train coming it can't stop before it hits. The nightmare of every train engineer is seeing a car or a person on the tracks and knowing there is nothing he can do.
There could be an app that will message the phone if the user is in the area of an intersection where a train is approaching.