Monthly Archives: April 2013

Collaborative Heatmap: Fav. Bike Route

Image

I’ve been playing around with a cool, real-time, client-side code driven cloud database called Firebase for the last while, and here is one of the projects that came out of it.

There is a local need to identify the streets and other routes that are actually used by cyclists in Prince George, BC (not just “where are the bike routes?”). That sounds like a heatmap to me. Using jQuery Mobile (frontend), Google Maps API (maps), and Firebase (backend), the user can add a direction line to the map (“Add Route” button), modify the directions if they do not show the desired route (drag the route or end points), and save the route (“Submit Route” button). Once the route has been saved, the heatmap will update to reflect the addition. And the cool part is: it will update everyone else’s view in real time, which is important because I know this will go viral. Also cool, I didn’t write a single line of server-side code.

Go ahead and play with the map – add as many lines as you want. I’ve set it so the directions default to Prince George, but you can drag and submit them wherever you want. The biggest limitation of the map is that the directions are converted to points to feed into the heatmap, so in the end it is really a heatmap of most popular corners, not routes.

Disclaimer: this seems to work fine in my versions of Chrome and IE (surprise), but not my iPad’s Safari. Please let me know if you have any insight.

Immersion wort chiller

20130420-140920.jpg
I’m not brewing beer this week, but I probably will get a batch started next weekend. One of the key parts of brewing is chilling the boiled wort (pre-beer) to yeast pitching temperature, quickly. Up until a few days ago, I was able to accomplish this by putting the wort pot in a snow bank in my front yard. But, with the arrival of spring, I needed to come up with a new plan.

This morning, I started researching other methods for cooling the wort, and decided to build an immersion wort chiller. Basically, cold tap water runs from a vinyl tube, through a copper coil (25′ long, 1/2″ OD), and deposits the water (and heat from the hot wort) down the drain. With the help of my plumber buddy’s tradesman’s discount, I was able to collect the necessary materials for $31.17 + tax. You can watch an exciting video of the wort chiller practicing for duty here.

Define Projections for Hard Drive of Files with os.walk

Received a hard drive full of imagery today. Tiles in two UTM zones, luckily specified in file name. Lots of folders. No projections defined. Here’s how to do it.

import os, arcpy
inFolder = r"ROOT PATH OF ALL IMAGERY"
folders = os.walk(inFolder)
sr9 = arcpy.Describe(r"PATH TO FILE ALREADY IN ZONE 9").spatialReference
sr10 = arcpy.Describe(r"PATH TO FILE ALREADY IN ZONE 10").spatialReference
for folder in folders:
 for file in folder[2]:
   if file.endswith(".ers"):
     if 'U10W84' in file: 
       arcpy.DefineProjection_management(os.path.join(folder[0], file), sr10)
     elif 'U9W84' in file: 
       arcpy.DefineProjection_management(os.path.join(folder[0], file), sr9)
     else:
       print file

Draggable Tissot Indicatrix

Image

Slow afternoon = time to play with Google Maps API. Lots of people bash Google and other slippy maps for using web mercator. Yes, it is distorted, but aren’t they all? Personally, I don’t have a serious problem with the distortion – I know it’s there. The “danger,” if there is one, is that some people don’t know mercator is distorted and go about their day thinking Greenland is the same size as South America (the horror). So, to help remind us all that mercator distorts area, here is a Google Maps API-based Tissot Indicatrix showing what happens to a 500km circle placed anywhere on the map (they are all 500km radius). And I do mean anywhere – you can drag the circles. Watch them change size, and get all funky at the poles.

UPDATE: this post has been featured in Google Maps Mania!

Minimalist GPX viewer

Image

I’m sure it’s been done before, but I made this minimalist GPX viewer today (relying heavily on the gpxviewer library). As long as you have a File API compliant browser (apparently not any version of IE), you should be able to load a GPX file from the top button, and it will load onto the map. Next step will be to save the GPX file to a shapefile.