iOS 气压计海平面高度
iOS Barometer SeaLevel Height
我正在为登山者制作一个 iOS 应用程序以从 SeaLevel 获取高度,目前我被困在这里。我使用 iOS Barometer 来获取详细信息,但它只提供 Pressure、Relative altitude 和 timestamp。是否有从海平面 获得 高度的计算?
我正在使用以下方式获取值。我正在使用 CMAltimeter
NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
formatter.maximumFractionDigits = 2;
formatter.minimumIntegerDigits = 1;
NSNumber *timestamp = [NSNumber numberWithDouble:altitudeData.timestamp];
NSString *timeInterval = [NSString stringWithFormat:@"%@", [formatter stringFromNumber:timestamp]];
NSString *altitude = [NSString stringWithFormat:@"%@", [formatter stringFromNumber:altitudeData.relativeAltitude]];
NSString *pressure = [NSString stringWithFormat:@"%@", [formatter stringFromNumber:altitudeData.pressure]];
self.label1.text = [NSString stringWithFormat:@"Time Interval: \n%@", timeInterval];
self.label2.text = [NSString stringWithFormat:@"Relative Altitude: \n%@", altitude];
self.label3.text = [NSString stringWithFormat:@"Air Pressure: \n%@", pressure];
请记住,这仅适用于 iPhone 6 及更高版本,因为只有它们内置了气压计。你要的公式叫测压公式。
P0 is sea-level pressure in hPa
P is atmospheric pressure in hPa
T is temperature in C
h is altitude in meters
#include <math.h>
h = ((pow(p0/p,1/5.257)-1)*(t+273.15))/0.0065;
我正在为登山者制作一个 iOS 应用程序以从 SeaLevel 获取高度,目前我被困在这里。我使用 iOS Barometer 来获取详细信息,但它只提供 Pressure、Relative altitude 和 timestamp。是否有从海平面 获得 高度的计算? 我正在使用以下方式获取值。我正在使用 CMAltimeter
NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
formatter.maximumFractionDigits = 2;
formatter.minimumIntegerDigits = 1;
NSNumber *timestamp = [NSNumber numberWithDouble:altitudeData.timestamp];
NSString *timeInterval = [NSString stringWithFormat:@"%@", [formatter stringFromNumber:timestamp]];
NSString *altitude = [NSString stringWithFormat:@"%@", [formatter stringFromNumber:altitudeData.relativeAltitude]];
NSString *pressure = [NSString stringWithFormat:@"%@", [formatter stringFromNumber:altitudeData.pressure]];
self.label1.text = [NSString stringWithFormat:@"Time Interval: \n%@", timeInterval];
self.label2.text = [NSString stringWithFormat:@"Relative Altitude: \n%@", altitude];
self.label3.text = [NSString stringWithFormat:@"Air Pressure: \n%@", pressure];
请记住,这仅适用于 iPhone 6 及更高版本,因为只有它们内置了气压计。你要的公式叫测压公式。
P0 is sea-level pressure in hPa
P is atmospheric pressure in hPa
T is temperature in C
h is altitude in meters
#include <math.h>
h = ((pow(p0/p,1/5.257)-1)*(t+273.15))/0.0065;