I imagine that there is sophisticated tracking technology built into the cars that would know their exact position along the rail at any moment. This likely could be pulled out and then used to generate either a length along the track from start, which would give you a position, or just flat out world space coordinates.
EDIT: It also would really depend on the actual task at hand. You might be able to get away with something like adding an onboard arduino with an IMU and getting the acceleration, then integrating acceleration into velocity and then being able to interpolate your position based on velocity over time, giving you a known distance from a reference (start) point. This however would likely result in large amounts of inaccuracy and drift, and no way inherently to error correct.
If outside, and the project is on a larger scale, you could use onboard GPS as well to help correct for the error in your IMU. This would be similar to the systems unmanned aerial vehicles use to determine their position for autonomous flight.
On a smaller scale, you might go with a depth camera tracking system: similar to how the Playstation Move tracks, or a Kinect. With two Kinects you would be able to triangulate distance from both Kinects and thus, offset in position from both. Other similar systems would be the Wii controller, which I believe people have plenty of hacks to make available as a position/orientation tracking device, and even head tracking software like TrackIR, OpenTrack or FreeTrack.