PyTopo can Show GPS from Image Files Now (30DayMapChallenge #15, My Data) (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Fri, 15 Nov 2024

PyTopo can Show GPS from Image Files Now (30DayMapChallenge #15, My Data)

[Screenshot of PyTopo showing the track (in purple) of a hike on Pajarito Mountain plus GPS locations for 16 images, which are in two clumps neither of which is near the actual hike track] For Day 15 of the 30 Day Map Challenge, "My Data", I'm highlighting a feature I added to PyTopo last week: the ability to read GPS tags in image files.

JPEG, and probably other image formats as well, lets you store GPS coordinates inside the EXIF (EXchangeable Image File format) metadata stored within each image file.

I've wanted that for a while, even though it's of limited use to me. The only camera I have that has GPS is the Pixel 6a phone, and I've written before about how my Pixel 6a stores the wrong GPS coordinates for photos.

Making that analysis was a little convoluted: I'd pick a recent photo of whose location I was sure, run jhead or exiftool to get the GPS coordinates, then run pytopo with those coordinates as well as the track of the hike I'd been on when I took the photo.

(PyTopo tries to be smart about interpreting the various formats for GPS coordinates; jhead uses a format like "N 35d 52m 25.94s" which is easy enough, but exiftool uses “35 deg 52' 25.94" N” which isn't easy to type into a shell since it has both single and double quotes; either the single quote or the double, I always forget which one, can't be escaped with a backslash so you have to resort to other tricks to escape it.)

Anyway, now I can just give PyTopo the name of one or more image files and it will show a waypoint for those images.

And when I ran it on sets of photos I'd taken on various hikes, I found out something very interesting about the Pixel's erroneous GPS.

The image above shows a recent hike on Pajarito Mountain. The purple line is the track of our hike; the waypoints are from all the images I shot on that hike.

I should mention that the code I added to PyTopo combines multiple photos into one waypoint only when the coordinates for the photos are all exactly the same; there's no "if within 100 feet" heuristic or anything like that.

As you can see, the Pixel only recorded two GPS locations over the sixteen photos I took on that hike. It assigned one location to nine of the images, and another to the remaining seven. And of course, neither of the two locations are particularly near the actual track we followed.

Of course it's possible that there was something super interesting in two places so I snapped a lot of photos, and nothing worth photographing anywhere else on the hike. You'll just have to take my word for it that that's not what happened; the photos were distributed at different places along the track, with no more than two or three ever taken from the same spot.

I tried sets of images from many different recent hikes. Every image set I tried was the same: all the photos I took that day are binned into one or two GPS locations.

This isn't because the phone didn't know where it is, obviously, since it recorded a perfectly fine GPX track for each of these hikes.

So it turned out this feature was more useful to me than I expected. Even though I already knew the Pixel was tagging images with the wrong GPS coordinates, I didn't know how wrong, and I had no idea that it used the same coordinate for many subsequent photos.

So at least I've learned something new. And who knows -- maybe my next phone, a few years from now, will actually record the correct coordinates.

Tags: , , , , ,
[ 12:33 Nov 15, 2024    More mapping | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus