would not hit the target at the speeds needed
As a projectile falls, it is accelerated by the force of gravity and gains speed.
you would need to shoot so high that you would be putting the dart into a sub orbital trajectory and without guidance be lucky to hit anything
The projectile fired by the railgun is GPS guided. What you're describing is literally the exact situation it is designed for. It is intended to leave Earth's atmosphere.
The GPS-guided projectile will exit the launcher at approximately 2500 meters/second. On the way to its target, the projectile would leave the Earth's atmosphere, making it less susceptible to jamming or interception, and minimizing interference with friendly aircraft upon re-entry into airspace.
https://www.globalsecurity.org/military/systems/ship/systems/emrg.htm
You're simply incorrect about how any of this works.