Skip to main content

Visualizing Location History

Image showing Taiwan made up of 3D hexagons.
Extruded Hexagons in Taiwan. Full Size

If you use Google Maps on your phone then it's quite likely you have location history enabled.

Google location history keeps track of where you go by uploading GPS data to your Google account. If you are fine with privacy considerations, then it can be a very useful service to have enabled. Use it to rediscover that hidden lane way coffee shop or reminisce about your travels.

Google maps provides a timeline view for each date and shows your GPS track on an interactive map. You can download the data from the Takeout page. Format options include JSON and KML.

I chose JSON and wrote a simple tool to extract the latitude, longitude and the timestamp. I also created an extra field that assigned a incrementing ID number for each day for grouping. I saved it out as a CSV.

Next in QGIS, I imported this text file as a delimited text vector layer which resulted in a map covered in points.

Map of New Zealand South Island with location points shown
Location Points in New Zealand

I wanted to visualize everywhere I've been in Taiwan over the past few years of living here.

To keep from revealing exactly where I live, I decided to use a hexagonal map instead of showing the raw points. You can create a hexagonal grid in QGIS from the Vector > Research Tools > Grid. I used TM97 as my projected coordinate system and set the hexagon tile size to 7km

Once I had my grid, I needed to clip it to the shape of Taiwan. To do this, I used the Extract by Location tool set to Intersect. The inputs were the grid and for the comparison shape, I used an outline of Taiwan I got from Natural Earth.

The next step was to count how many location points were inside each hexagon feature. The Count points in Polygon does exactly this.

I applied the following filters to the grid and saved out a separate shape file for each result.

To visualize it in 3D, I used Blender. There's a free addon called BlenderGIS that can import a shape file as a 3D object.

I extruded each model and added a slight bevel at the top which helps improve the lighting.

Image showing Taiwan made up of 3D hexagons.
Extruded Hexagons in Taiwan. Full Size

Adding the terrain

Mountainous terrain covers a large part of Taiwan. Because of this, the majority of the population live near the coastlines. I wanted to see what a stylized terrain would look like on the hexagon grid map.

I went back into QGIS, and loaded the SRTM DEM of Taiwan. A quick Google search revealed the tool I would need this time was Zonal Stastics. This allowed me to calculate the average height for each hexagon feature. I found that the grid and the DEM needed to be in the same projected coordinate system for it to work.

I now had a grid that contained another field that I could later use in Blender.

To make it look nicer, I did this with a 3KM grid instead of my original 7KM

This time when I reimported the files in Blender, I extruded the "0 visits" by the height attribute.

I applied a 15x vertical exaggeration to the terrain by scaling it on the Z axis. This resulted in a clear definition of where the mountains were.


The final step was to make a camera fly-through of the island. I used a simple HDRI + Sun lighting system and reflective materials for the hexagons.

Source Code

  1. Location History.json to CSV Converter