I just got back from a trip to the Maldives and Dubai. I’m an inveterate data hoarder,
particularly when it comes to travel, and I had a GPS tracker on pretty much the whole
time. But extracting and labeling the interesting waypoints from the tracks would be
tedious. I did it for the 20 SCUBA dives (by correlating the GPS tracks and the times
recorded by my dive computer), but no way was I going to bother for the many places I
visited on land.
Luckily, I’m also a habitual Foursquare/Swarm user, so I’d “checked in” at most of the
interesting places anyway. But how to get that data out of Foursquare and into my GPS
tracks?
Happily, there are a couple of Python libraries that make it easy. I adapted the examples
from the documentation for foursquare and
gpxpy to write the following scripts.
You’ll need to sign up as a Foursquare Developer
and register an App (it doesn’t need to actually do anything) to get a client_id
and client_secret to access the API. Make sure you specify a redirect_uri for your
app that exactly matches what you enter below…
First, I grab all of my Foursquare data and store it in a file in one-JSON-per-line format:
Now let’s make a GPX file for each month with a waypoint for each venue
(keeping only the first time it was visited):
In the process of figuring out how to do this, I discovered Fog of World,
a “game” where you try to visit the entire world. Happily, it lets you import GPS traces, so now
I have yet another way to hoard data. h/t philsturgeon