0

I am updating my app to allow photo uploads to included GPS metadata when using UIImagePickerControllerSourceTypeSavedPhotosAlbum. The GPS data's accuracy is very important. I am running into an issue where the location data derived using ALAsset is different than the photo's actual exif data I can see when opening the same photo in Photoshop.

I have used two methods to read the GPS data in xcode:

ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) {

CLLocation *location = [myasset valueForProperty:ALAssetPropertyLocation];

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

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

}

AND

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);

}

On a representative photo I am using as an example both sets of code above give me a latitude of 47.576333 which converts to 47,34,35N

If I look in Photoshop exif data - the latitude is 47,34,59N

These numbers are close - but they aren't the same. This happens without about 30% of my photos. Any idea why?

Edit - Photo shop does not give seconds - it give 34.59 minutes which is indeed accurate.

Kara
  • 6,115
  • 16
  • 50
  • 57
Jennifer
  • 158
  • 5
  • 47,34,35N is not a correct representation. look again, is that 47*34'35"N (called DMS) or 47*34.35'N (called DM), where "*" means the degrees symbol, which my ipdad does not have. – AlexWien Mar 07 '13 at 08:54

1 Answers1

1

Your conversion is wrong, photoshop is more correct.

47.576333 (DEG) converts to 47* 34.5799' (DM). which can be rounded to 47* 34.58
which is the format photoshop obviously displays.

converted to DMS it gives your value: 47* 34' 35" N. (Please replace all "*" with degrees symbol.)

So you exchanged DMS (Degress Minutes Seconds) with DM (Degrees Minutes) representation.

AlexWien
  • 28,470
  • 6
  • 53
  • 83
  • I misunderstood - I thought Photoshop was giving me 34 minutes and 59 seconds but you are correct - it is 34.59 minutes. Thank you. – Jennifer Mar 07 '13 at 21:56