CLLocation altitude property validity in flight

2019-07-21 04:59发布

问题:

I understand the concept of negative for below sea levels and positive for above + there is vertical accuracy to check the sanity of this value.

I am interested in GPS data in a flight. What could be the max or approx max value of altitude so that I can differentiate Flight from road travel.

I understand I can query the speed but speed itself won't solve the purpose.

回答1:

The proper way to determine flight from GPS altitude is to lookup the ground elevation of the current location (latitude/longitude) in a database. If the GPS altitude is greater then the user is in flight (or in a tall building).

This takes a very large database but the data is available. This is probably not practical for most apps. Look for DEM data (digital elevation model) databases such as SRTM, ASTER (see here)

Another method would be to detect take off. If you are only interested in flight in jet aircraft, you would need to detect acceleration in a straight line from <10 knots to >100 knots, and then if the GPS altitude climbs by > 1000 fpm, you are likely in a jet taking off (although most prop planes can also climb >1000fpm).

Detecting all kinds of flight (airships, hot air balloons, light aircraft) gets more difficult. It's hard to distinguish between an aircraft and a car climbing mountains, though it is possible with various heuristics. It would also be difficult to distinguish a hot air balloon vs a tall building, low horizontal motion and both cases elevation is above ground level.