nemethviktor / GeoTagNinja

A lightweight photo geotagger for Windows.
https://geotag.ninja
GNU General Public License v3.0
22 stars 1 forks source link

Export to GPX track file aka inverse geotagging #114

Closed Kudolpf closed 1 month ago

Kudolpf commented 1 month ago

Request summary It would be very useful to be able to generate a GPX track file built from the gps data of existing geotagged images. In geosetter this is the Export to GPX Track File option. In exiftool it is referred to as Inverse Geotagging image

Why this feature is helpful It is not uncommon to capture geotagged photos on a phone alongside photos on a camera without GPS. For example when travelling I'll often use my phone for capturing mundane moments or for quick sharing online, but will use my camera when the situation calls for better photography. Constructing a GPS track file from the phone images is a simple way to correlate locations as often images will be captured on both devices at the same time and place. This is a reliable solution when when you haven't captured a more detailed GPS track through other means. It is possible to create a similar GPS track using google timeline data, however this is more convoluted and less clean than using data from a selected set of images.

Example solution workflow The workflow in geosetter works well, with a couple of possible areas for improvement.

  1. Navigate to and select the images that contain the location data that you want to extract
  2. Select the Export to GPX Track File option
  3. In the prompting dialog, choose some options for the file (more on these options below), and the file name and location to save to
  4. A track is built and saved using the locations from only the images that were selected

Options and considerations

Thanks for your work in creating this amazing tool, it's really been a massive help for me. Geosetter does not support HEIC images, which unfortunately are what most of my phone images are from the last 4 years. GeoTag Ninja has been a lifesaver, I've been using exiftool instead to create GPS tracks but if the function existed in GTN it would save me so much hassle and time!

nemethviktor commented 1 month ago

Hi, noted, I'll have a look next week most likely. In the meanwhile if you have some heic files that have the gpsdatetime in them that'd be great because i am not even sure that's being extracted at the moment [i don't have any apple products and hardly use my phone for photos...]

In particular re: sorting, some of that (especially the custom sort option) might be tricky. The ET documentation doesn't have info on custom sort beyond what's on the page you also mentioned, which isn't a lot. exiftool -r -if '$gpsdatetime' -fileOrder gpsdatetime -p gpx.fmt pics > out.gpx ...so I assume there is a way to do filename or some such but not sure about custom.

Kudolpf commented 1 month ago

Thanks! I don't have any heic files with a gpsdatetime, I'm using a samsung but it seems very device dependant which tags are saved. I've found some other heic original samples online, they all have different mixtures of data stored but none have used the gpsdatetime as far as I can see.

When using exiftool, I was doing a sort based on the CreateDate, and similarly I replaced the gpsdatetime in the gpx.fmt template to using CreateDate. I had to subtract the timezone offset to correct it to UTC time as the CreateDate option is a local time. Given that none of my files had the gpsdatetime tag I use an if check on gpslatitude to check whether that image should be used for creating the track file. For reference, the command I was using was exiftool -r -ext HEIC -if "$gpslatitude" -fileOrder CreateDate -p gpx.fmt DIR > exportedTrack.gpx

It looks like CreateDate and DateTimeOriginal are pretty universally used fields, so seemed safer to use this and just deal with time zone offset somewhat manually for the gps time.

The main fileOrder options I imagine I'd use would be CreateDate/DateTimeOriginal, or FileName (possibly inverted, by using a - before the field name)

nemethviktor commented 1 month ago

Can you have a play with this https://drive.google.com/open?id=16laoPJcsJJz6mdkcjWvoQu6wWXiILbQy&usp=drive_fs please and see if it largely does what you're after? (same place as the import feature just a new tab.) The UTC conversion is actually automatically done inside ET (assuming there's a time offset value so you won't see it being shown.

nemethviktor commented 1 month ago

Hi @Kudolpf , can you have a look at the above please;)