ios - Access Gelocation from UIImage -


i can location information photo album on ios, access image location (latitude , longitude) when took photo.

so image finished event

  public override void finishedpickingmedia(uiimagepickercontroller picker, nsdictionary info)     {         //uiimagepickercontroller.referenceurl         var originalimage = new nsstring("uiimagepickercontrolleroriginalimage");         var image = (uiimage)info[originalimage];                 foreach (var item in info)                 console.writeline(item.key + "  " + item.value);           image.savetophotosalbum(delegate(uiimage img, nserror err)         {             console.writeline("saved!");          });           _dp.dismissmodalviewcontroller(true);          onimagechoosed(image);     } }  

and in info dictionary, can see properties

uiimagepickercontrollermediametadata  {     dpiheight = 72;     dpiwidth = 72;     orientation = 6;     "{exif}" =     {         aperturevalue = "2.27500704749987";         brightnessvalue = "5.267792568433492";         colorspace = 1;         datetimedigitized = "2015:07:08 14:24:15";         datetimeoriginal = "2015:07:08 14:24:15";         exposurebiasvalue = 0;         exposuremode = 0;         exposureprogram = 2;         exposuretime = "0.008333333333333333";         fnumber = "2.2";         flash = 24;         focallenin35mmfilm = 29;         focallength = "4.15";         isospeedratings =         (             40         );         lensmake = apple;         lensmodel = "iphone 6 camera 4.15mm f/2.2";         lensspecification =         (             "4.15",             "4.15",             "2.2",             "2.2"         );         meteringmode = 5;         pixelxdimension = 3264;         pixelydimension = 2448;         scenetype = 1;         sensingmethod = 2;         shutterspeedvalue = "6.908853996279415";         subjectarea =         (             1631,             1223,             1795,             1077         );         subsectimedigitized = 927;         subsectimeoriginal = 927;         whitebalance = 0;     };     "{makerapple}" =     {         1 = 2;         14 = 0;         2 = <af001d01 9001ed01 9e011f01 70001500 41000d00 0a001000 12000900 0e000e00 b5003201 ae01f701 9b010401 5b001400 47002300 11001500 15000800 0d000d00 c2005501 eb014402 c901d900 67002400 3d002400 0f000b00 08000900 0d000d00 f1009201 30028e02 ff01b200 51000e00 43000e00 0d000e00 0d000d00 0c000b00 2d02b302 f802e902 26029700 80005600 5e000e00 0b000a00 09000900 0a000900 88039703 87033503 3c028300 44001100 45001100 0c000d00 0d000d00 0d000a00 b903b103 97034703 44027700 3e001000 38001000 0d000d00 0e000d00 0d000a00 a4039f03 87031503 22026d00 38000b00 34001000 0d001000 12000b00 0b000900 7b036a03 1d039c02 e2016400 37000e00 32001100 0d000a00 0a000600 07000700 c0029a02 4e02fb01 79015b00 36000e00 31001200 0c000900 0a000700 0c000b00 8b017801 4b013501 01015500 34000a00 30000900 06000c00 0e000800 14001000 b9001a00 34008a00 bd005000 2f000c00 2f000c00 0c000b00 0d000500 07000700 60000e00 0c002400 8f004b00 2f000a00 2d000f00 0e000700 07000700 0b000a00 47000b00 0a000b00 3d003300 28000a00 2b000a00 06000a00 0e000700 12001000 29000a00 09000a00 25003b00 2a000e00 2a000c00 0b000e00 11000700 0a000c00 27000a00 08000a00 0f003f00 3f001b00 31000d00 0e000700 07000700 0a000800>;         3 =         {             epoch = 0;             flags = 1;             timescale = 1000000000;             value = 401611073225666;         };         4 = 1;         5 = 128;         6 = 119;         7 = 1;         8 =         (             "0.01929908",             "-0.713904",             "-0.7083461"         );     };     "{tiff}" =     {         datetime = "2015:07:08 14:24:15";         make = apple;         model = "iphone 6";         software = "8.3";         xresolution = 72;         yresolution = 72;     }; 

as see there no location information. tried save image on local after location informatin didnt work.

as understand, if can path of image saved photo album, can got

var path = args.info[uiimagepickercontroller.referenceurl].tostring(); 

refeenceurl above , after can location.. dont know how path of newly saved image.

p.s.: used xamarin.ios c# doesnt matter if provide objective c or swift code.

i have old snippet i've never used (its nsmutabledictionary category), because in app i've used avfoundation, worth try. credits creator of code gustavo ambrozio.
since old should adapt arc compatibility.

- (id)initwithinfofromimagepicker:(nsdictionary *)info {      if ((self = [self init])) {          // key uiimagepickercontrollerreferenceurl exists in ios 4.1         if ([[[uidevice currentdevice] systemversion] floatvalue] >= 4.1f) {              nsurl* asseturl = nil;             if ((asseturl = [info objectforkey:uiimagepickercontrollerreferenceurl])) {                  alassetslibrary *library = [[alassetslibrary alloc] init];                 [library assetforurl:asseturl                           resultblock:^(alasset *asset)  {                              nsdictionary *metadata = asset.defaultrepresentation.metadata;                              [self addentriesfromdictionary:metadata];                          }                         failureblock:^(nserror *error) {                         }];                 [library autorelease];             }             else {                 nsdictionary *metadata = [info objectforkey:uiimagepickercontrollermediametadata];                 if (metadata)                     [self addentriesfromdictionary:metadata];             }         }     }      return self; } 

Comments

Popular posts from this blog

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -