Also radar altimeters. They actually measure the height not from level sea but from earth level. For planes, known landmarks or mountains can be used to calculate precise height. Eg. somewhere we know that height from sea level is 1500feet. If the radar measures another 8000feet, then this plane is at 9500 feet.
This is basically the way.