Create a Heat Map Using Google Docs

Post by Matt Nohr

Using Google Docs new Fusion Tables makes it really easy to create heat maps with just a list of longitudes and latitudes.

In this example, I will use the GPS data from my watch to create a heat map that shows where the common areas are that I run:

Heat Map

Get Data

To get the data, I exported all of the history from my GPS-enabled watch software. The only trick here was converting GPX data to CSV. If you want to do this, you can use the Groovy script at the bottom of this post, or there are a number of sites online that will convert many different GPS formats for you (this one for example)

There are also a number of apps for iPhone and Android that will let you export your GPS data.

Create The Heat Map

Once you have your data in CSV, you are ready to follow these simple steps to create your heat map.

  1. In Google Docs, choose to Create > Table. Note: this is currently in Beta
  2. Upload your data on the Import step.
  3. You now need to tell Google to use the columns Latitude and Longitude as “location” columns.
    1. Edit > Modify Columns
    2. Select the first column (either Latitude or Longitude)
    3. Change the type to “Location”
    4. Check the “Two column Location” box and make sure the Latitude and Longitude are assigned correctly
      Heat Map Configure
  4. Now check out the map:
    1. Visualize > Map
    2. Check the “Display as heat map” checkbox near the top

Groovy Script

Here is a simple Groovy script to convert GPX to a CSV list of longitude and latitude:

//get all the GPS points
def gpx = new File('running.gpx')
def gpxData = new XmlSlurper().parseText(gpx.text)
def allPoints = gpxData.depthFirst().findAll{it.name() == 'trkpt'}

//create the new CSV
def csv = new File('running.csv')
allPoints.each{csv << "${it.@lat.text()},${it.@lon.text()}\n"}

Note: this script converted over 5000 data points in just over 1 second.

This entry was posted in Agile Processes, Misc and tagged , , , , . Bookmark the permalink.

Related Posts:

7 Responses to Create a Heat Map Using Google Docs

  1. Pingback: An Army of Solipsists » Blog Archive » This Week in Grails (2012-17)

  2. Pingback: Questa settimana in Grails (2012-17) - luca-canducci.com - Il blog di Luca Canducci: notizie, tips e nuove tecnologie dal mondo dell’IT.

  3. Abhishek says:

    I can think of lot many interesting things you can do with these maps. Interesing idea.

  4. Matt Nohr says:

    Also, the more data you have, the more interesting the heat map. In this example I used about 5000 data points and going up to 6000 and then 7000 adds much more detail when zooming in and out.

    It is also good to note that you can use the Google Maps API to create these maps in javascript. Here is one example from Google: https://developers.google.com/fusiontables/docs/samples/heatmap

  5. Matt Nohr says:

    Update a few months later: The latest version of Google’s fusion tables no longer have an option for displaying as a heat map. At least for the short term you can switch back to the “classic look” and follow this tutorial. However, going forward this may not be supported.

  6. James says:

    Hello.

    I’ve been trying to reproduce this but (shame on me, I’m a fairly novice user) I’ve been unable to locate the Edit > Modify Columns controls.

    Are they still there and I’m missing them or have they since been replaced by another analogous command?

    Any help much appreciated. Thank-you.

  7. Matt Nohr says:

    First, it looks like the tables functionality has been removed from Google Drive by default. However, you can add it back by connecting the “Fusion Tables” app.

    Once you have it, you still have to go to “Help > Back to Classic Look” before you’ll be able to use the heat map functionality.

    Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>