Tool for adding exif data to images
- Add as much metadata to exif as possible (at the very least time and location)
- Make tool to interpolate google location history exported data with narrative location data for better accuracy of location.
- Should have setting to determine how old location data should be used for exif location
I looked at the metadata that got downloaded, and I'm not 100% convinced that there is enough info to correlate the position data with the image URL (and hence the filename). Are you convinced that you know how to do this? Otherwise it might mean a re-download of the metadata....
This tool would be great to have.
It appears that the timestamp in the positions.json doesn't correspond with any actual images. It might be the actual timestamp from GPS. The taken_at_local in the photos.json is probably the local clock on the clip. Maybe the trick is to treat the positions.json as a track and then interpolate the photos along the track.
I also note that the timestamps in the positions.json are not ordered in time. For example, one of my moments:
$ jq . < positions-1.json | grep timestamp
"timestamp": "2014-11-29T17:09:49Z"
"timestamp": "2014-11-29T16:15:08Z"
"timestamp": "2014-11-29T18:19:34Z"
"timestamp": "2014-11-29T16:58:41Z"
"timestamp": "2014-11-29T17:17:24Z"
$ jq . < photos-1.json | grep taken_at | head -5
"taken_at_local": "2014-11-29T10:52:08-05:00",
"taken_at_local": "2014-11-29T10:52:38-05:00",
"taken_at_local": "2014-11-29T10:53:08-05:00",
"taken_at_local": "2014-11-29T10:53:39-05:00",
"taken_at_local": "2014-11-29T10:54:09-05:00",
These photos (the first 5 in the moment) predate the first GPS location.
@pjsg No. All relations between images and location data need to be interpolated based on timestamps, with an adjustable allowed offset. There is no correlation between the GPS data and images/videos whatsoever. The GPS simply stores a snapshot every so often, and if that snapshot ends up in a fix (not very often to be perfectly honest, this isn't exactly high quality GPS hardware we are talking about here), then an entry is made in the locations metadata, connected to the given "moment".
So yeah. Only way you can link an image to a position is to find the position with the closest (in time) timestamp, if the time difference is below a given threshold, use that position, if not, don't use a position at all, alternatively interpolate the position based on previous and next location and time difference.
When I get around to making this tool, I want to include the ability to use a data dump from google location services as well as the narrative gps data, as that will give a much higher chance of images actually being located.
And yes. I am convinced I know how to do this. And no, it will not require re-downloading meta data. All of the meta data has already been downloaded. There isn't any more data available (through their public APIs at least). Re-downloading it will not help at all.
Just one idea, I would not interpolate. Usually the GPS location only changes, when you actually have moved. Before the move the previous location would be more appropriate in my opinion. So instead of interpolating I would use the location that was acquired on the time of the photo or before.
Actually I wrote a small Java tool to do this given the output of narrative-ripper. Might make it public if there is a demand (it also fixes the photo file names, so they are in order). Good idea with the Google location history, I'll see if I can add this as some moments do not have a location at all.
@michaeldiener Actually. It really depends on situation, which is why this is rather hard. I think a combination of the two, and a choice made based on proceeding positions is best. To illustrate what I mean:
If you are using the clip at a conference, then all of the positions would be within approximately 500 m range of each other, and it would be natural to use the closest position timewise (or potentially an average) when no close timestamp is available.
However. When hiking in the mountains, positions would follow a rough path, and the more correct assumption would be that a location between two known locations would be somewhere between the to locations, based on time difference.
Yeah. Since most of my moments are from conferences and similar indoor situations, most of them don't have locations at all :(
Time has come for me to download it all. I will be hacking this tool in the next days to get it going for my needs. Regarding exif, I only care about knowing in which city/country I was, so +-5km is perfectly fine for me. Is there any draft of this feature ? Which python exif manipulation library would you recommend ?