Monday, January 6, 2014

Course de Bruxelles

Since my last post I've put a few miles in around Brussels. Many of those miles were spent hopelessly lost in vaguely familiar corners, down winding streets with 5 names, in the cold battering rain. But then somewhere around 50 miles or so, I was getting less and less lost. If you can break the habit of running the same routes, it becomes one of the best exploration tools for learning a place.

Trying to get lost can be terrifying without a map, but also turns on a basic survival instinct. At first it will feel scary and strange, it will fill you with insecurity, but after you get over that, it turns into a liberating confidence. Now about 170 miles into Brussels, I'm fairly confident in my explored section of the city. Granted, it's mostly just a few miles around my apartment, but these routes are not just familiar, they are starting to feel like mine.

I was curious to actually see this new place that I'd claimed, but Garmin doesn't do multiple route overlays, and Strava charges you for their heatmap feature, so I decided to figure it out on my own. It took a little bit of perseverance, but it was a great way to learn the Google Maps API, and the resulting map provides great introspective details of my running habits here. I found it interesting that most of my runs are north/south, rather than east/west, I'm not sure why. It does motivate me to want to run east/west more often and to expand my known areas of the city.

A few technical bits regarding the map that I learned:

  • Garmin will export a KML file that the Gmaps API can render, so you don't have to run some crazy regex to extract LatLng points like I did at first.
  • The Garmin KML file, however, also includes a series of "track points" that it uses to animate a cursor on its website which obscure the polylines so you'll need to delete that from each KML file.
  • The Gmaps renderer caches KML files for some indeterminate length beyond 5 minutes to prevent denial of service attacks, so if you are wondering why your map isn't updating, it's not your fault.
  • You are limited to 10-20 KML overlays on a single map. If you exceed the KML data limit, none of the overlays will appear. Just keep commenting layers out until they appear again.
  • The "Googley" engineers working on the KML format thought it'd be cool to style your polylines with a hexadecimal system that is backwards from html so instead of the #RRGGBB that most of the modern world has used since the dawn of additive color theory, it goes AABBGGRR, AA is for alpha transparency (also very convenient as a hexadecimal rather than an integer, so 50% is 7F, not .5).
Other than that, it was fairly straight-forward and the examples provided were extremely helpful.

No comments: