GeoLocate images using Google Location Data

I’m not sure if there is already easy ways to do this in DarkTable, but assuming there isn’t, would a PR to allow the direct use of Google Location JSON data (AKA Google Takeout) to GeoLocate images in DarkTable be accepted?

I would want to add a new item to the dropdown list of formats and have everything just work.

you could convert your json to gpx:

2 Likes

PR == pull request? If that means you already have a working implementation, you could probably give others access to that implementation to test it?

Has somebody been able to make this work? For some reason I am having hard time with it.

I don’t think so. What problem are you having?

I have a few…

  • As per the site - the user is expected to execute the following code
python location_history_json_converter.py "Location History.json" locations.kml -f kml -i

However - “Location History.json” does not exist. I can see “Records.json” that is very big - more than 500 MB for me.

If I descend further - I can see the following

Location History/Semantic Location History/2019/2019_JUNE.json

This file is more manageable - I can open it in text edit and can see latitude and longitude but the instructions are unclear what I am supposed to use “Records” or the month file “2019_JUNE.json”

  • Assuming that it is the month file I tried to execute
python3 location_history_json_converter.py "2019_JUNE.json" 2019_JUNE.gpx -f gpx -i

While there is no error on screen I can only see the following in the produced .gpx

<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="Google Latitude JSON Converter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
  <metadata>
    <name>Location History</name>
  </metadata>
</gpx>

No real data is present.


Python 3.10 essentially. And I am already on PopOS 22.4.
So - is it that new version or I am doing something wrong?

I also double checked I run the following

pip install Shapely

And I am afraid I am quite stuck with the task.
Maybe I am at the wrong version of Python and I don’t know how to install it or
Maybe I am using the wrong file but if I try to execute it on the “Records” file …
Wait…

IT WORKED!!! IT WORKED!!! IT WORKED!!!

I don’t know what I missed yesterday… I was testing again - while I was posting here.
Including my head banging above so if somebody else is going this way hopefully it would be of help.

Conclusion

  • The needed item is Records.json
  • What I run was
python3 location_history_json_converter.py "Records.json" Records-tracks.gpx -f gpxtracks -i

  • The important part is that the format is gpxtraks. but the output file name is .gpx
  • To import in Darktable - I first moved all the images to UTC time zone using apply offset
    image
    As it is grayed out - I changed the hour only then clicked tab and this made the button available
  • When I applied the GPX track file (another miss for me - it is just there - on the screenshot and I did not see it before) I went straight for open - the preview crashed for me the first time
  • Finally I reverted the date back to the original applying the offset again to match the original image taking time.

Well - it all worked very nice at the end. I am hoping this would be of help to somebody…
The instructions on the other sites are very good but for some reason I ended up stumbling quite a bit.

FYI there is also a CLI program called gps babel : https://www.gpsbabel.org/ that is specifically for converting between GPS formats.

1 Like

Thank you! I didn’t know about it.

1 Like