Recently, Ben outlined how to use the Create Grid and Heatmap tools in Alteryx, using data on car accidents across the UK. He based his Heatmap workflow on his Create Grid workflow since he already had that in place but actually the process of making heatmap can be done in fewer steps than that, as we don’t need to create grids before using the Heatmap tool.

You only need an input with coordinate data (e.g. latitude and longitude), transform this to spatial points, and then run them through the heatmap tool. If you want to use the output in Tableau you will also need to transform the data to a format that Tableau can process, which means changing the spatial points back to coordinates (and in the case of polygons and lines also specify the order in which they are connected).

However, when I tried to strip down Ben’s grid workflow, removing the summarise tools and the Make Grid tool, I got persistent error messages from the Heatmap tool. As error messages go, they weren’t very useful in directing me towards a solution. Why was my heatmap not working even though the second data input wasn’t used at all in the original example? The spatial match was just creating a massive file, from which I ended up just using the car crash points anyway. So surely I should just be able to take those out?

Chris Love came to the rescue, Apparently the Heatmap tool does not work if your data has any records with missing centroids. This was the case for 28 incidents in this dataset, as some car accidents did not have valid location information. These cases were filtered out in Ben’s workflow when using the spatial match, which is why the tool was working just fine then.

Using a filter to discard the cases that did not have a valid centroid the Heatmap tool is now able to process the dataset and create polygons to create our final heatmap.

Heatmap workflow