Is it possible, in an iPhone app, to extract location information (geocode, I suppose it\'s called) from a photo taken with the iPhone camera?
If there is no API ca
I think the selected answer is wrong, actually. Well, not wrong. Everything it said is correct, but there is a way around that limitation.
UIImagePickerController
passes a dictionary along with the UIImage
it returns. One of the keys is UIImagePickerControllerMediaURL
which is "the filesystem URL for the movie". However, as noted here in newer iOS versions it returns a url for images as well. Couple that with the exif library mentioned by @Jasper and you might be able to pull geotags out of photos.
I haven't tried this method, but as @tomtaylor mentioned, this has to be possible somehow, as there are a few apps that do it. (e.g. Lab).
Unfortunately no.
The problem is thus;
A jpeg file consists of several parts. For this question the ones we are interested in are the image data and the exif data. The image data is the picture and the exif data are where things like geocoding, shutter speed, camera type and so on are stored.
A UIImage (and CGImage) only contain image data, no tags.
When the image picker selects an image (either from the library or the camera) it returns a UIImage, not a jpeg. This UIImage is created from the jpeg image data, but the exif data in the jpeg is discarded.
This means this data is not in the UIImage at all and thus is not accessible.