Lightroom: Throws away GPS info from my Nexus 5 photos when I change any metadata

  • 2
  • Problem
  • Updated 3 years ago
  • Solved
  • (Edited)
I can take a photo I took on my Nexus 5 and view the EXIF data and see that the GPS info is there. I then import the photo into the current version of Lightroom on desktop and change some metadata (e.g. add a description). If I then view the file's EXIF data the GPS information is removed.

It looks like there is a bug with Lightroom and Nexus 5 GPS data. (Lightroom also has trouble viewing the GPS data, but 3rd party programs can see it fine.) It seems like a bad bug to throw away data like this. I can provide a sample image if that helps.
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 2
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14147 Posts
  • 1765 Reply Likes
Hi Owen, a test file would be helpful.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3712 Posts
  • 971 Reply Likes
Verify that you don't have an Import metadata preset that's clearing the GPS fields (this is a pretty common mistake). In the Import window in the right-hand column, under Apply During Import, set Metadata to None:

Then import a fresh pic from the Nexus 5. If the problem still occurs, upload a sample pic to Dropbox and post the link here. (I believe the forum software will strip metadata if you attempt to include a pic directly in a post.)
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes
Thank you for the quick reply. I double checked the settings and metadata is none. I reimported to the same effect.

Attached is the original image, the image after adding a description (and no other changes), screenshots of EXIF before and after, and a zip of the jpgs.

I checked the file after being imported into Lightroom and the exif data is still there. It's only after I make a change is it cleared out.

https://drive.google.com/folderview?i...

Thanks,
Owen
Photo of John R. Ellis

John R. Ellis, Champion

  • 3712 Posts
  • 971 Reply Likes
The EXIF GPS metadata in the sample image you provided isn't strictly standards-conforming. It represents the GPSLatitude and GPSLongitude fields with values of type SRATIONAL (signed rational, type = 10), rather than RATIONAL (unsigned rational, type = 5), as specified in the Exif 2.3 spec (page 69-70). I used a hex editor to change the representation from SRATIONAL to RATIONAL, and then LR read the GPS coordinates just fine. Ideally, LR would be more forgiving and accept this non-standard representation (as the third-party Exiftool does), but you can't really say this is a bug in LR.

You could work around the problem by using Exiftool to rewrite the latitude/longitude:

exiftool "-gpslatitude<gpslatitude" "-gpslongitude<gpslongitude" myfile.jpg

See the Exiftool documentation for how to run that command on a batch of photos in a folder.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3712 Posts
  • 971 Reply Likes
I updated the formatting of this post to display "<" correctly.
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes
Thanks again for this tip. It correctly fixed my GPS metadata in all my photos.

Unfortunately, LR doesn't like it if you have unsaved metadata changes (with Save Metadata off) and will ask if you want to keep the file or in memory changes. So I ended up having to redo all my metadata changes again. But at least now I have correct GPS info.
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes
Thanks for the detailed info -- that was very helpful. I will report it to Google so they can fix it on their end. Still, LR should not dispose of an EXIF field if I change an unrelated field. The Nexus 5 is a reasonably popular phone and many people could have their GPS data inadvertently removed.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3712 Posts
  • 971 Reply Likes

I then import the photo into the current version of Lightroom on desktop and change some metadata (e.g. add a description). If I then view the file's EXIF data the GPS information is removed.
...
Still, LR should not dispose of an EXIF field if I change an unrelated field.

To clarify, when you first import the pic into LR, the GPS coordinates are already missing from LR's Metadata panel. As discussed above, this isbecause LR isn't able to read them. Changing another field (e.g. Caption) after import doesn't cause the coordinates to disappear.
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes
John, that's not quite right. While LR is never able to show the GPS data, the GPS coordinates are removed from the original after I edit the caption.

Here's what I did:
1. Import the photo into Lightroom.
2. Use Show Original to locate the master and inspect the exif data with a 3rd party tool.
3. Observe the GPS data is present.
4. Add a caption in Lightroom.
5. Lightroom writes to the master because the setting to save metadata to the file is enabled.
6. Open the original in the EXIF tool again.
7. Observe the GPS data is missing.

You can see this in the files I uploaded to Google Docs. The only thing I did between before and after is change the caption, but the GPS coordinates are not present in the after version.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3712 Posts
  • 971 Reply Likes
Got it -- I now understand what you mean by "cause the coordinates to disappear." Like most programs, LR reads in the entire metadata into its catalog, and then when there are changes, it writes out the entire metadata from its catalog. Since it wasn't able to read the non-conforming GPS coordinates, they never made it into its catalog, and thus when it wrote out the metadata, the old non-conforming coordinates were removed. That is, LR doesn't read and write individual metadata fields -- it writes out the entire set of metadata.

Note that changing the caption isn't necessary to cause this to happen -- just do Metadata > Save Metadata To File, and the non-conforming GPS coordinates will be removed.

It would be a very simple change for LR to also read the non-conforming coordinates, avoiding this issue entirely.
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes
Yeah, that would be an ideal solution. (Alternatively a dialog that pops up if there's invalid exif data when you save: "This photo contains invalid EXIF data. Do you want to overwrite it? Yes/No/Don't ask me again")

Thanks for looking into this for me.
Photo of David Franzen

David Franzen, Employee

  • 99 Posts
  • 20 Reply Likes
Hi Owen,

Thank you for reporting this and providing an example. Can you tell us what version of Android your phone runs? If you update Android does the problem still happen with new photos (shot after an update).

Thanks,
David
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes
The Nexus 5 runs Android L 5.1.

The photos were shot on the current version as well as older versions of lollipop (this has happened since I got the phone in February).
Photo of David Franzen

David Franzen, Employee

  • 99 Posts
  • 20 Reply Likes
Owen,

What's the name of the camera app you are using to take the picture, and what if you try different camera apps? Also, how do you transfer the photos from your phone to Lightroom

I also noticed the time stamp in your metadata is invalid in Lightroom and Camera Raw: "2015:08:02 24:32:57". The hour is expected be in the range 0-23. Various third-party programs I've tried interpret this in different ways: some also as invalid, some as August 2 and some as August 3.

Thanks,
David
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes
David, that is *very* odd. I took it at 12:32 am on the 3rd of August.

I used the official Google Camera app:
https://play.google.com/store/apps/de...

I tried a 3rd party camera app and the data appears to be correct (the GPS data isn't lost after changing some exif metadata). I uploaded the images to Google Drive:

https://drive.google.com/folderview?i...
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes
To transfer the photos, I connect my phone to the computer via USB and use the official Android File Transfer tool to browse to the camera directory and copy the files over.
Photo of Hein Roehrig

Hein Roehrig

  • 4 Posts
  • 0 Reply Likes
I'm seeing the same problem of Lightroom not recognizing GPS coordinates but Exiftool showing them. This is with a Nexus 6 phone and the standard camera app. Example: https://www.dropbox.com/s/9j0f0o8k9yc...

(The way of getting the picture off the device doesn't seem to matter: I tried USB download, Lightroom mobile sync, syncing via Google Photos and downloading from the web; they all lead to the same effect.)

It seems like this is a bug on the Android side. However, in the spirit of Postel's law of being generous on input and strict on output it would be great if Lightroom could be made to cope with the slight deviation from the exif standard.

Thanks!
Hein
Photo of Bhavesh Joshi

Bhavesh Joshi, Employee

  • 5 Posts
  • 4 Reply Likes
Hi Owen,
Thanks for bringing this to notice.
I looked into this and I am able to reproduce this issue.We are investigating more into it.

-Bhavesh (Lightroom Team)
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes
Thanks!
Photo of Hein Roehrig

Hein Roehrig

  • 4 Posts
  • 0 Reply Likes
Any update on resolving this issue? Thanks :-)
Photo of John R. Ellis

John R. Ellis, Champion

  • 3712 Posts
  • 971 Reply Likes
LR CC 2015.2.1 / 6.2.1 appears to correctly read the GPS coordinates from the original test image:

https://drive.google.com/folderview?i...
Photo of Owenn

Owenn

  • 11 Posts
  • 0 Reply Likes
I can confirm it works on my copy. Thanks for you help with this!
Photo of Hein Roehrig

Hein Roehrig

  • 4 Posts
  • 0 Reply Likes
Adding the example files does get the location correctly for me as well.

However, I can't figure out how to update the location for photos that already are in my catalog -- "synchronize folder" with "scan for metadata updates" doesn't help (which kind of makes sense since the metadata didn't get updated).

Any advice would be greatly appreciated.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3712 Posts
  • 971 Reply Likes
"However, I can't figure out how to update the location for photos that already are in my catalog"

There are a number of possibilities to consider:

1. If you haven't made any edits or changes to metadata to the files since they were imported into LR, then you can safely do Metadata > Read Metadata From File, and that should bring in the GPS information from the files.

2. If you've done Metadata > Save Metadata To File on the files, or you have set the option Catalog Settings > Automatically Write Changes To XMP, then the GPS information was probably overwritten by LR and is permanently lost.

3. If you haven't done Metadata > Save Metadata To File and you haven't set the option Catalog Settings > Automatically Write Changes To XMP, then the GPS information is likely still in the files. If you do Read Metadata From File, that will import the GPS information into LR but overwrite any edits and changes to metadata you've made in LR.

If you're in situation 3 and you really want both the changes you've made and the GPS location, then it's possible to script a solution using the free Exiftool, but it could take you many hours. I can give you hints about how to do that but can't write the script for you.

If you're not sure whether the GPS information is still in the files, then unless you know how to use Exiftool, the easiest way to determine if the GPS info is still there is: Create a new test LR catalog. Make sure the option Catalog Settings > Automatically Write Changes To XMP is off. Import the suspect photos into the new test catalog, and look in the Metadata > Location panel.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3712 Posts
  • 971 Reply Likes
Correction in the last paragraph: If you're not sure whether the GPS information is still in the files...
Photo of Hein Roehrig

Hein Roehrig

  • 4 Posts
  • 0 Reply Likes
Thank you John, this was super helpful. I went with option 1 since for these photos I hadn't touched the metadata in any significant way.