http://en.wikipedia.org/wiki/Selective_door_operation
The real, less trivial problem is only opening the doors of train cars that actually fit on the platform.
GPS was just a poor choice of positioning system. There are already widely deployed systems where what is essentially an RFID tag sits at a fixed point on the track between the rails and, when scanned, tells the train exactly where it is.