How to create a heatmap in QGIS?
The motivation?
As a daily bicycle commuter, I try to record every commute with the Strava application. The Strava is one of many sports tracking application which offers pairing with fitness trackers and recording your training sessions, sharing that with other users, and so on — you get the point.
The great thing about the Strava app is that you can download your history data. History data means everything you posted on Strava (e.g. pictures, posts, comments..) and that also includes GPS data. Since I was cycling for a longer period, (I have 236 rides recorded, a little over 2000km in total) I wondered what it would look like if I visualize all my rides on the map? So, I downloaded all my data from Strava and imported it to the QGIS.
The picture above shows all my rides on the map, and that is nicely visualized in QGIS. Except for the fact I didn’t visit every neighborhood in the city, you can’t read much more from this map. Not by visualizing the data this way. This map becomes much more interesting if you convert it to the heatmap. The main idea with heatmaps is to replace the numbers with colors.
How to make Heatmap with QGIS?
Making heatmaps with QGIS is much easier than you think. If you have your data and QGIS, probably the hardest thing is to figure out colors and opacity combinations.
Before you begin, make sure that you have the data you want to visualize and you need to install QGIS software, everything else QGIS will do for you. In this example, I used my data downloaded from the Strava application.
When you open QGIS and navigate to the folder with your GPS records, you will see something similar to the screen above. Then you need to add the data to layers, and if you have a large number of records, the easiest way to import all the data is to use the Batch GPS Importer plugin. Just go to Plugins > Manage and install plugins and search for Batch GPS Importer.
After you run the Batch GPS Importer, you will see the window above. Select your folder with GPS data, give that layer a name, select geometry type, and click import. Depending on the number of files and your PC you will wait a few minutes for the plugin to import all the data.
When all the data is loaded, you will have a new layer that contains all the data you imported. Go to layer setting and follow the steps on the image above.
If you followed all the steps, you should have the window shown in the picture above. That’s where you can adjust your heatmap settings. You have to play with the settings to find out which combination fits your use case. Actually, you only need to choose the colors in the color ramp menu and adjust the radius and map units for radius.
The result
When converted to the heatmap, that GPS data from the Strava app became much more interesting. You can easily tell that most of the time I commute along the same route. And that is true, I follow that same route almost every day because it’s the most logical and comfortable for me.
To sum up, this simple example of heatmap can be applied in various use cases. Experimenting with different settings you can achieve different results which may help you to better understand the data.
I hope someone finds this useful, so if you are reading this, what to say other than thank you!
If you have any questions or suggestions feel free to comment or contact me on my LinkedIn profile.