Note that there are some explanatory texts on larger screens.

plurals
  1. POHow Do I Get The Correct Latitude and Longitude From An Uploaded iPhone Photo?
    text
    copied!<p>My problem actually seems rather silly... I am writing an iPhone application that uses MKMapKit. The app grabs the EXIF metadata from a provided geotagged photo. The problem is that the latitude and longitude coordinates that I retrieve, for example:</p> <p>Lat: 34.25733333333334</p> <p>Lon: 118.5373333333333</p> <p>returns a location in China. Is there a regional setting that I am missing or do I need to convert the lat/long coordinates before using them?</p> <p>Thank you all in advance for any help you can provide.</p> <p>Here is the code I am using to grab the GPS data. You'll notice I am logging everything to the console so I can see what the values are:</p> <pre><code>void (^ALAssetsLibraryAssetForURLResultBlock)(ALAsset *) = ^(ALAsset *asset) { NSDictionary *metadata = asset.defaultRepresentation.metadata; NSLog(@"Image Meta Data: %@",metadata); NSDictionary *gpsdata = [metadata objectForKey:@"{GPS}"]; self.lat = [gpsdata valueForKey:@"Latitude"]; self.lng = [gpsdata valueForKey:@"Longitude"]; NSLog(@"\nLatitude: %@\nLongitude: %@",self.lat,self.lng); }; NSURL *assetURL = [mediaInfo objectForKey:UIImagePickerControllerReferenceURL]; ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; [library assetForURL:assetURL resultBlock:ALAssetsLibraryAssetForURLResultBlock failureBlock:^(NSError *error) { }]; UIImage *img = [mediaInfo objectForKey:@"UIImagePickerControllerEditedImage"]; previewImage.image = nil; self.previewImage.image = img; NSData *imageData = UIImagePNGRepresentation(img); if ([imageData length] &gt; 0) { self._havePictureData = YES; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload