Regular Running

As someone who’d hoped to run 1,000 miles this year (Update/Spoiler Alert: I’m going to fall about 80 miles short), I have a regular running route that I follow.

My most common run is the one I do during the week, during my lunch or some time in the afternoon, around the campus of Georgia Tech. This is a pretty popular urban ‘trail’ known as the Pi Mile and I can extend it from 5k to around 7k by running a bit longer on 10th Street, depending on the amount of time I have on any given day.

After doing some detective work using SmashRun, I determined that I’ve run this route 59 times in 2016!

I did a little bit of file conversion and “wrote” some additional code since my last mapping project, and ended up with some fun visualizations of all that data.

Here, then, are variations of a heat map of all my Pi Mile runs in 2016:

Here’s the actual source code I used myself to create all the maps above:

library(plotKML)
library(ggplot2)
library(ggmap)

# GPX files downloaded from Runkeeper
files < - dir(pattern = "\\.gpx")

# Consolidate routes in one drata frame
index <- c()
latitude <- c()
longitude <- c()
for (i in 1:length(files)) {
    
  route <- readGPX(files[i])
  location <- route$tracks[[1]][[1]]
  
  index <- c(index, rep(i, dim(location)[1]))
  latitude <- c(latitude, location$lat)
  longitude <- c(longitude, location$lon)
}
routes <- data.frame(cbind(index, latitude, longitude))

# Map the routes
ids <- unique(index)
plot(routes$longitude, routes$latitude, type="n", 
axes=FALSE, xlab="", ylab="", main="", asp=1)
for (i in 1:length(ids)) {
  currRoute <- subset(routes, index==ids[i])
  lines(currRoute$longitude, currRoute$latitude, col="#0066FF20")
}

# Plot over map of campus
GnatsMap <- qmap(location = 'Georgia Institue of Technology, Atlanta', 
zoom = 15, maptype = 'satellite', source = 'google')

GnatsMap +
  geom_path(aes(x = longitude, y = latitude, group = factor(index)), 
  colour="#1E2B6A", data = routes, alpha=0.3)

All the GPX files (which you can get from Strava) need to be in one directory when you run the script in R.

To change the color of the routes, modify this hex value:

for (i in 1:length(ids)) {
  currRoute < - subset(routes, index==ids[i])
  lines(currRoute$longitude, currRoute$latitude, col="#0066FF20")
}

To change the underlying map, change this portion:

qmap(location = 'Georgia Institue of Technology, Atlanta', zoom = 15, 
maptype = 'satellite', source = 'google')

Many thanks to the code of Saul Torres-Ortega and Frazier at UCSB.

Refer back to this PDF if you need additional help fussing with the underlying map. If the parsing of the GPX files is the issue, I’d look at the original code I borrowed.

One of the things that jumps out at me, if you look solely at the heat map (without geo data), is that the data is really noisy where/when I start my runs (upper right side). As you can imagine I’m not running across 75/85 in Midtown Atlanta, but that’s what the data shows.

Probably just the nature of tracking GPS with a phone, but the fidelity of the rest of the data seems solid. You can tell at one point when I’m choosing to run on one side of the sidewalk versus the other (lower right side, near Bobby Dodd) and the rare occasions – when I extended a 5k/7k into something more like a 10k – those are the thinner, lighter lines on 10th Street and some of the streets interior to tech’s campus (mostly left side of the map).

If you want to see another cool visualization of the same area of midtown using public running data from Strava from 2015, it’s also pretty cool.

Until next time, Run Happy!

Mapping creatively

For a long while, I’ve had this crazy idea about private spaces – theme parks and sports arenas, mostly – utilizing Google’s mapping technology to provide people with rich, interactive experiences whether in the planning stages, at an event or just re-living an experience.

Well today the Official Google Blog revealed cool new features of their Maps & Transit products, namely metro transit information for the New York City metro area. Google Maps Mania has more info, including a video:

All of this is well and good until you start thinking of all the ways it could be so much cooler.

Like mobile access via your iPhone or Android phone.
Or combined with photos and videos pertinent to your location(s).
And to think about how you’d aggregate those kinds of things (I don’t want to say “assets” or “content”) from both individuals and corporations.

My head is going all fuzzy just thinking about these implementations (present AND future) as being the more natural outgrowth of those creepy eyeball-targeted ads in Minority Report. There you were targeted based on what you’d made public; here you target for yourself based on your needs.

Subtle, to be sure, but isn’t the evolution of Facebook’s Beacon typical of the differentiation I’m making here?

Anyhow, I just think it’s a cool day for the data. I say we ought to let it co-mingle and play more often.

Here’s hoping I dream up some fun way to engage fans in ways they’ll *want* to use in the flow of their lives. We should be so lucky and so humble of our successes.

Happy Mappy (unrelated) Tuesday!