Skip to content

Instantly share code, notes, and snippets.

@ymollard
Created August 18, 2018 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ymollard/00a2e86f37f6c4927e8efd10f0bc3c7e to your computer and use it in GitHub Desktop.
Save ymollard/00a2e86f37f6c4927e8efd10f0bc3c7e to your computer and use it in GitHub Desktop.
Generating GPX by hand and Geocoding pictures with GPicSync on Linux

Generating GPX by hand and Geocoding pictures with GPicSync

This reminder applies if you have pictures that need geocoding (e.g. to be uploaded on Mapillary) but you have no GPX file. We assume you have captured pictures alonside a path from a start point to an en point and that you are able to redraw this path precisely on a map. The first step will be to generate manually a GPX file, then to synchronize it with your pictures thanks to timestamps, and then GPicSync will geocode.

  1. Download GPicSync, install dependencies and make sure you can run the GUI with Python 2, e.g. python2 gpicsync-GUI.py
  2. Draw you actual path on https://geojson.net/ with these recommandations:
  • Place points at every key location, e.g. when you turned or passed in front of a remarkable location that is easy to distinguish visually on pictures (building, square, monuments...)
  • Find a good compromise between numerous points (= very accurate path) and few points (= faster to proceed manually)
  • It is better if you kept a constant pace during capturing. If not, consider adding point every time your pace increased, decreased, or had a break
  1. Select Save > GPX and download file map.gpx
  2. Format the GPX so that it contains timestamps for each point by executing these commands:
sed -i -e 's=<metadata/>=<metadata></metadata>=g' map.gpx
sed -i -e 's=/>=><time>'`date --rfc-3339=seconds | sed 's/ /T/'`'</time></trkpt>\n=g' map.gpx
  1. Open map.gpx with a text editor, e.g. gedit map.gpx
  2. By hand, for each trkpt point of your GPX: 5.1. Take note of the location of this point on the path your drew on geojson.net 5.2. Look for the picture that best matches this point as precisely as possible (use remarkable elements such as buildings or monuments) 5.3. In your iamge viewer, select properties to get the capture time (Be careful: find the precise time the picture was taken, not the modification or access time!) 5.4. Edit the <time> attribute of this trkpt with the corresponding date and time
  3. Open The GPicSync GUI
  4. Click Pictures folder to select your pictures folder
  5. Click GPS file to select the map.gpx file edited hereabove
  6. Activate option interpolation via its checkbox
  7. Click on Synchronise! to start geocoding. The process can take a while. Check that the GSyncPic journal does not mention any error. Successful geocoding should display:
(Found R0010734.JPG ...taken 2018-08-15-17:57:16, writing best latitude/longitude match to picture: N 44.839283 ,W -0.559697 : time difference (s)= 6

You can then upload these geocoded pictures on Mapillary. This process will precisely respect the path you drew but may stretch or squeeze points along it. If you observe that points are not reguarly distributed along the path while you ketp a regular path, add more timestamped key points and re-geocode. Also, if your camera recorded right compass angles, you should see that the direction of points (the green cone on Mapillary) matches the direction of your journey, this is a good way to check synhronization thanks to direction changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment