OJW's image locator script

From OpenStreetMap Wiki
Jump to navigation Jump to search


This script can combine a directory full of JPEG images, with a GPX tracklog, to produce a list of latitude/longitudes for each photo.

It takes into account the differences between your camera's clock and the GPS clock if you know them - one way to find this out is to take a photo of the GPS while it's displaying a clock.

Currently, it creates an HTML file showing thumbnails of each photo, with latitude/longitude, time, and the error (the difference in seconds between photo and the nearest GPS timestamp found)

Source code

OJW's image locator script - source code


perl ImageLocator.pl [Tracklog file] [Image directory] [GPS time] [Camera time] > output.html

Running the program

  • ImageLocator.pl is the perl script (follow the source code link, and save it as a text file called ImageLocator.pl)


  • Tracklog file is a GPX with tracklogs
  • Image directory contains a load of JPEGs
  • GPS time and camera time refer to the timestamps from GPS and camera respectively, for the same instant.
  • GPS and camera times are in the format hh:mm:ss
  • GPS time is likely to be using UT, so adjust accordingly.
  • Output is to STDOUT as HTML, so > output.html stores that output in a file

Sample data

Example output


  • Not XML-aware, relies on gpsbabel's particular GPX output format
  • Only searches backwards in time (i.e. the tracklog just before the photo was taken)
  • Complete lack of commenting or neat headers

See also