【问题标题】:ALAsset GPS Metadata does not match the exif GPS dataALAsset GPS 元数据与 exif GPS 数据不匹配
【发布时间】:2013-03-06 20:09:12
【问题描述】:

我正在更新我的应用程序以允许在使用 UIImagePickerControllerSourceTypeSavedPhotosAlbum 时将照片上传到包含 GPS 元数据。 GPS 数据的准确性非常重要。我遇到了一个问题,即使用 ALAsset 派生的位置数据与我在 Photoshop 中打开同一张照片时看到的照片的实际 exif 数据不同。

我使用了两种方法来读取xcode中的GPS数据:

ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) {

CLLocation *location = [myasset valueForProperty:ALAssetPropertyLocation];

latitudeString = [NSString stringWithFormat:@"%g",point.latitude];

longitudeString = [NSString stringWithFormat:@"%g",point.longitude];

}

与

ALAssetRepresentation *representation = [myasset defaultRepresentation];
NSDictionary *metadata = [representation metadata];

NSDictionary *gpsDict = [metadata objectForKey:@"{GPS}"];

NSNumber *latitudeNumber = [gpsDict objectForKey:@"Latitude"];

NSNumber *longitudeNumber = [gpsDict objectForKey:@"Longitude"];

if ([[gpsDict valueForKey:@"LatitudeRef"] isEqualToString:@"S"]) 
{

   //latitudeNumber = -latitudeNumber;
}

if ([[gpsDict valueForKey:@"LongitudeRef"] isEqualToString:@"W"])
 {

  //longitudeNumber = -longitudeNumber);

}

在我使用的代表性照片上,上面的两组代码都给了我 47.576333 的纬度,它转换为 47,34,35N

如果我查看 Photoshop exif 数据 - 纬度是 47,34,59N

这些数字很接近 - 但它们并不相同。这发生在我没有大约 30% 的照片的情况下。知道为什么吗?

编辑 - 照相馆不给出秒数 - 它给出了 34.59 分钟,这确实是准确的。

【问题讨论】:

  • 47,34,35N 不是正确的表示。再看一下,是 47*34'35"N(称为 DMS)还是 47*34.35'N(称为 DM),其中“*”表示度数符号,我的 ipdad 没有。

标签: ios gps latitude-longitude exif alasset


【解决方案1】:

你的转换是错误的,photoshop更正确。

47.576333 (DEG) 转换为 47* 34.5799' (DM)。可以四舍五入到 47* 34.58
这是photoshop明显显示的格式。

转换为 DMS,它会给出您的值:47* 34' 35" N。 (请将所有“*”替换为度数符号。)

因此,您将 DMS(Degress Minutes Seconds)与 DM(Degrees Minutes)表示交换。

【讨论】:

  • 我误解了 - 我以为 Photoshop 给了我 34 分 59 秒,但你是对的 - 它是 34.59 分钟。谢谢。
猜你喜欢
  • 2011-02-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-11-07
  • 2016-09-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多