sgeo --trip: draw the journey your photos took, as a path on the map

sgeo --trip: draw the journey your photos took, as a path on the map

sgeo plotted your geotagged photos as markers on a map. The new --trip mode draws the journey instead: the stops in timestamp order, connected as a blue polyline with time labels, so the map reads as a route rather than a scatter of pins.

This is a follow-up to stag and sgeo: turn a folder of photos into a CSV of GPS points and a map. The input is the same CSV stag writes — no new scan, and no sfile binary needed at draw time.

Usage

$ make sgeo
$ stag photos/            # -> geotags.csv
$ sgeo --trip geotags.csv # -> trip.png

The output defaults to trip.png. Tiles come from OpenStreetMap at runtime, as with sgeo itself, and the © OpenStreetMap contributors attribution is baked onto the image.

What it draws

One red marker per geotagged row, one blue leg between consecutive stops in timestamp order, an arrowhead at each leg's midpoint showing the direction of travel, and a time label (MM-DD HH:MM, UTC) by every timestamped marker. Rows with no timestamp go last, in CSV order, with a marker but no label; rows with no coordinates are skipped.

Timestamp order, not file order

The rows are sorted by their parsed timestamp — a CSV in filename order is almost never in time order. Both timestamp forms stag emits sort together: ISO (2024-05-01 12:34:56) and the EXIF-colon form the fallback path passes through (2024:06:15 08:30:00). A text sort would put every colon-form row after every dash-form row whatever the dates, so the sort parses the timestamp instead.

Example

Five photos around San Francisco, listed in the CSV in filename order — c.jpg first, a.jpg second:

file,format,latitude,longitude,altitude,datum,timestamp,source
c.jpg,JPEG image,37.784900,-122.379400,,WGS-84,2024-05-01 10:00:00,EXIF GPS
a.jpg,JPEG image,37.774900,-122.419400,,WGS-84,2024-05-01 08:00:00,EXIF GPS
d.jpg,JPEG image,37.754900,-122.439400,,WGS-84,2024-05-01 11:00:00,EXIF GPS
b.jpg,JPEG image,37.804900,-122.409400,,WGS-84,2024:05:01 09:00:00,EXIF GPS
e.jpg,JPEG image,37.794900,-122.439400,,WGS-84,,EXIF GPS
plain.jpg,JPEG image,,,,,,

The drawn path is 08:00 downtown → 09:00 Telegraph Hill → 10:00 over the Bay → 11:00 Castro → the untimestamped stop last. The b.jpg leg is the proof of the mixed-format sort: its EXIF-colon 09:00 slots between the two ISO timestamps.

Source and docs

sgeo --trip is in cnmcdee/sfile (src/sgeo.c, 11/11 tests in tests/run_tests.sh pass), documented in docs/trip-path.md. Limits worth knowing: trips crossing the antimeridian draw the long way around, and labels in a dense cluster can overlap — split the CSV if they collide.

Linux Rocks Every Day
Decode any of these formats with sfile — a unified header decoder for the 831 formats documented on this blog.
Geotagged photos? stag lists every GPS point as CSV and sgeo plots them on a map — both in sfile.