Astronomers routinely use this affect to determine the speed (along the line of sight) of very distant sources whose motion cannot be seen directly. The job is harder because you don't have the luxury of having the source come by you to see the equivalent of the change in pitch. In fact, you cannot really tell if this train is moving, unless you know the frequency of its whistle with the train, say, at rest.
Here is how you can do it. The figure below shows an actual example of the spectrum (intensity of detected light as a function of its frequency) of a galaxy studied by one of our graduate students, Michael Way. The measured spectrum is shown in red. The largest peaks, and even some of the tiny ones, are identifiable to the trained astronomer. For example, the largest one is due to light emitted by electrons making a specific transition between atomic levels in ionized Oxygen. The second to the left of this one is due to a transition in Hydrogen. And so on... Now, because it is known at what frequency these peaks should show up if the galaxy were at rest, one can tell that the spectrum of the galaxy really looks like the green curve (shifted down for clarity) and it has been shifted to the right (longer wavelength instead of smaller frequency) because the galaxy is moving away from us, at 67 million miles an hour in this case!