0

I get a photo for my app with help of UIImagePickerController. Is it possible to get Geo data from the delegate:

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

Here is info dictionary, is it possible to get Geo tags from it?

ArisRS
  • 1,362
  • 2
  • 19
  • 41

2 Answers2

1

use EXIF library http://code.google.com/p/iphone-exif/

code

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
    NSData* jpegData = UIImageJPEGRepresentation (image,0.5);
    EXFJpeg* jpegScanner = [[EXFJpeg alloc] init];
    [jpegScanner scanImageData: jpegData];
    EXFMetaData* exifData = jpegScanner.exifMetaData;
    EXFTag* latitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLatitude]];
    EXFTag* longitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLongitude]];
...}

SO question: UIImagePickerController and extracting EXIF data from existing photos

Community
  • 1
  • 1
Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
  • Thanks, but how I can extract gps data from the EXFTag* latitudeDef? As I understand from the SO question, there is no gps data in the (UIImage *)image. – ArisRS Sep 07 '11 at 16:49
  • I know this question is too old.But need to use this iphone-exif toolkit to extract the data. I have downloaded and added the library but it shows Undefined symbols for architecture i386: "_OBJC_CLASS_$_EXFJpeg", referenced from: objc-class-ref in ViewController.o error when running the project. D you know why?. I think this is becaue the library doesnt support new architectures. Is there any updated version of this? – Johnykutty Mar 22 '14 at 17:07
0

Up to and including iOS 5.1.1, the UIImagePickerController does not add GPS location data to photos shot using it. It doesn't matter what the setting of location services for the Camera app is, that only controls that app not the UIImagePickerController.

You will need to use the CLLocation class to get the location and then add that to any images and videos shot with the UIImagePickerController.

Chris Markle
  • 2,076
  • 4
  • 25
  • 46