Shelter-in-Place Journal, Day 170

My goal today was to finish editing the photos from our New York trip in 2008, but I got distracted.

As I’ve said before, I am geotagging and titling every photo I keep. I try to use Lightroom’s built-in map search to do the work, but sometimes it doesn’t find an address or building name, so I turn to Google Maps, which is much better at figuring things out.

But it’s not easy to get a latitude and longitude out of Google Maps; it gives you something called a Plus Code (for example, the Plus Code for Grand Central Terminal is “87G8Q23F+34”). And there’s code on GitHub to turn a Plus Code into a latitude and longitude.

Except that Google actually gives a “shortened” code – one which is relative to a city nearby (in this case, “Q23F+34 New York”), and the sample code I found couldn’t handle a shortened code very easily.

The Google Maps API can handle the shortened code just fine, though, so I wrote a very small and simple-minded program to convert a Plus Code to a latitude and longitude that I can paste into Lightroom. And a TextExpander snippet to make it easy to do so.

While I was at it, I let the program pass basically any string to Google Maps in the hope that it’ll recognize it:

> ./ Grand Central Terminal

And I added a special case for coordinates that I cut-and-paste from geocaches to convert “N 40° 41.117 W 073° 58.509” to “40° 41.117 N 073° 58.509 W” because Lightroom wants the hemisphere label after the coordinate value.

Oh, yeah, I had to create an API Key to use the geocoding service and tie it to my Google Account.

But with all that done, I can copy a plus code or an address or coordinates from a geocache into the “GPS” field in Lightroom, type ‘;pc’ and voilà, my photo is geotagged!

Of course, as I was writing this post, I discovered that Lightroom’s Map Module search will use a shortened Plus Code just as well as it uses an address. But I’m still glad I wrote this code, because it saves me a trip to the Map Module.

That’s my story and I’m sticking to it.