Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios ALAsset GPS元数据与exif GPS数据不匹配_Ios_Gps_Latitude Longitude_Exif_Alasset - Fatal编程技术网

Ios ALAsset GPS元数据与exif GPS数据不匹配

Ios ALAsset GPS元数据与exif GPS数据不匹配,ios,gps,latitude-longitude,exif,alasset,Ios,Gps,Latitude Longitude,Exif,Alasset,我正在更新我的应用程序,以便在使用UIImagePickerControllerSourceTypeSavedPhotosAlbum时允许将照片上载到包含的GPS元数据。GPS数据的准确性非常重要。我遇到了一个问题,使用ALAsset导出的位置数据与在Photoshop中打开同一张照片时看到的照片的实际exif数据不同 我使用两种方法读取xcode中的GPS数据: ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *mya

我正在更新我的应用程序,以便在使用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];

}

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

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

这些数字很接近,但不尽相同。这种情况发生时,我的照片没有30%左右。知道为什么吗


编辑-Photo shop不提供秒-它提供34.59分钟,这确实是准确的。

您的转换是错误的,photoshop更正确

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

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


因此,您将DMS(度数分秒)与DM(度数分秒)表示法进行了交换。

47,34,35N不是正确的表示法。再看看,是47*34'35“N(称为DMS)还是47*34.35'N(称为DM),其中“*”表示度数符号,我爸爸没有。我误解了-我以为Photoshop给了我34分59秒,但你是对的-是34分59秒。非常感谢。
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);

}