The location of trains within a railway system is derived
a number of ways and for multiple purposes.
One use of this data is for train prediction - in the UK,
these are the dot-matrix displays on the platforms and
concourse which show you the expected
of your train.
Or sometimes Delayed or Cancelled.
This data is usually derived from track circuit or axle
counter block data - which tells the passenger
system the approximate location of the train. The
calculates the predicted arrival time from the current
location and expected delay.
The resolution of this system is pretty low - signalling
blocks can be very long.
However, given that your train is carrying many
with GPS enabled phones...
A system which collects GPS data from multiple
phones could interpolate train position to a higher
resolution, allowing more accurate train arrival
GPS is not considered accurate enough (generally) for
railway signalling (as it may have to distinguish between
trains located on adjacent tracks) - but it may be that
filtering across a large-enough set of data provides
accuracy for railway signalling also.