How does my phone tell me my elevation even though I'm nowhere near a cell tower?
This is determined by satellites in the horizon mapping out where your phone is (according to multiple posts on Stack Overflow, including https://stackoverflow.com/questions/13329714/how-does-my-iphone-get-its-altitude). Note that the accuracy from this method is not usually precise, but it is a rough estimate of your elevation.