CenterOfLife

CenterOfLife renders Google Maps location history data in a visually appealing and meaningful way. This script processes your KML-encoded location history data, improves visibility of the individual traces, and plots this data into an SVG file. The result is a map of where you have been, densely and accurately showing the paths you traveled and the places that you have seen.

Before: Raw KML data

After: Processed by Center Of Life

Applied processing includes:

  • Path denoising: It rarely happens that you jump across lakes. A configurable amount of path segments is skipped whenever the distance to any other vertex in this range is shorter than the distance to the direct successor. This helps with "jumping" locations as it is typical for GPS-based and WiFi/GSM-based location tracking.
  • De-duplication of vertices: You don't care when you are asleep. Put down your mobile phone at night, and it will still record many, almost identical points with a changing timestamp. This blows up the SVG file size, and may also confuse the adaptive rendering. To avoid both, these points are skipped.
  • Adaptive rendering. You see more from the world when you slow down. This is reflected in the stroke opacity, which will be higher (darker) if you move slow, and lower (brighter) if you move fast. This way, areas which you cross by foot will show up more prominently than a train ride which only allows for short glimpses. However, if you take this ride more frequently, lines will overlap, and the route becomes more prominent on the map. In the end, you know your daily commute very well, don't you?

Location History T-Shirt

I used this script to design myself a T-Shirt featuring my own location history within my neighborhood. The steps were pretty simple:

Post-processing: Select interesting area, fade out boundaries.

Pre-print editing: Invert colors, overlay with a little 'glow'.

Production: Upload to T-Shirt printer's website and configure. I used Spreadshirt to print mine.

Final result: Happy. The print turned out a little brighter and with fewer shades, but overall the result is really great.

How-To

Thanks to a clearance granted by my employer, I can provide this script as open source software. To render your own location history, just take the following steps:

  1. Download CenterOfLife. Follow the link, and click the arrow button in the top right corner to save a local copy.
  2. Download a recent copy of your personal location history. Go to Google Takeout, click "Unselect all", then scroll down to "Location history". Select location history for download, and make sure to select "Format: KML" from the drop-down box in the same row. Finally, click "Proceed" on the bottom of the page, and follow the instructions until you have a ZIP archive with your personal data.
  3. Unzip the location history. All you need is the KML file, and the CenterOfLife script.
  4. Run center_of_life.py with appropriate parameters.

Syntax:

python center_of_life.py <in.kml> <out.svg> [<options>]

Options:

  • -x, --width: With of the bounding box of the resulting SVG image. Auto-determined by height if not set. Defaults to 5000 if height is also undefined.
  • -y, --height: Height of the bounding box of the resulting SVG image. Auto-determined by width if not set.
  • -f, --from: North-west corner of the focus area in degrees, in the form Lon:Lat. Defaults to -180:-90 (off the shores of Alaska).
  • -t, --to: South-east corner of the focus area in degrees, in the form Lon:Lat. Defaults to 180:90 (to Australia, and far beyond).
  • -d, --denoise: Denoising weight. Up to this many points will be skipped whenever this shortens the path.

You typically want to set -f, -t, and -d. While -f and -t steer the visible area in the plot, -d is useful to denoise zoom-ins, for which paths would normally be all blurred into each other. As a general rule of thumb, I use -d 4 for villages, -d 3 for towns, -d 2 for regions, -d 1 for states/countries, and -d 0 for continents and larger.

These are the invocations I used to generate some of my plots:

python center_of_life.py history.kml europe.svg -f 6.65:45.75 -t 12:51.65 -d 0
python center_of_life.py history.kml switzerland.svg -f 5.5:45.5 -t 10.5:48 -d 1 
python center_of_life.py history.kml switzerland_east.svg -f 8.2:47 -t 9.8:47.8 -d 2 
python center_of_life.py history.kml zurich.svg -f 8.45:47.3 -t 8.65:47.45 -d 3

Downloads