IPhone - access to location information from a photo

Is it possible in an iPhone application to retrieve location information (for example, a geocode, let's say it's called) from a photo taken with an iPhone camera?

If there is no API to call, is there any known way to parse data bytes to extract information? Can I drop something on my own?

+9
iphone cocoa-touch geolocation geocoding
Mar 05 '09 at 19:47
source share
2 answers

Unfortunately not.

So the problem is:

The jpeg file consists of several parts. On this issue, we are interested in image data and exif data. Image data is an image, and exif data is where things like geocoding, shutter speed, camera type, etc. are stored.

A UIImage (and CGImage) contain only image data, without tags.

When the image picker selects an image (either from a library or from a camera), it returns a UIImage, not a jpeg. This UIImage is created from jpeg image data, but exif data in jpeg is discarded.

This means that this data is not in UIImage at all and therefore not available.

+6
Mar 05 '09 at 19:55
source share

I think the selected answer is actually erroneous. Well, not like that. All he said is correct, but there is a way around this limitation.

UIImagePickerController passes the dictionary along with the UIImage , which is returned. One of the keys is UIImagePickerControllerMediaURL , which is the "file system URL for the movie." However, as noted here in newer versions of iOS, it also returns the URL for the images. Share this with the exif library specified by @Jasper, and you can pull the geotag out of the photos.

I have not tried this method, but as @tomtaylor said, it should be possible somehow, as there are several applications that do this. (e.g. Lab ).

+2
Dec 11 2018-10-11
source share



All Articles