Learn how to map geographic variations of income with Alteryx
This month we are going to illustrate some of the mapping functionalities of Alteryx. More precisely, we would like to visualise the variations of the average income in Belgian municipalities. We also want to see clearly which municipality of every region has the highest mean income.
Prepare your data
First of all, we have prepared an input data table containing, for the 581 municipalities in Belgium the five-digit code, the name, the region, the mean gross income data calculated by SIRIUS Insight, the number of declarations and a spatial polygon. These data are directly used in the Report Map Tool.
Setup of your map
To make a map we use the Map Report Tool from the reporting toolbar. Before we actually start to map the data, we have to think about how we will use the map afterwards. In this case we want to be able to print the map on a landscape oriented A4 and we also want to add a legend on the side. This is why we choose a dimension of 25 x 21 cm.
Be careful if you have never configured this before. Your distance units might be set to miles instead of kilometers. You can change the default distance units in the "Localisation" tab of the "User Settings" menu.
In the Map Report Tool we select in the Data tab the following items:
- SpatialObj as the spatial object representing the municipalities.
- Mean Income as the thematic field that we aim to represent.
- Name as the label that will be written on each polygon.
- The region will be used as grouping field, meaning that a map will be drawn for each region.
In the Layers tab, we create a new layer (by clicking on the + sign) based on data source #1 (this is connection #1 as shown in the screenshot below) and we name it Mean income. We select a Tile method to separate the municipalities in different categories of color. Here we choose the Smart Tile method based on the standard deviation of the mean income.
Indicating the highest mean income
We want to visualise clearly the municipality of each region with the highest mean income. To achieve this, we are going to add a black frame around these municipalities. This means we first have to find these three municipalities before we can add the black frame around them.
To select the municipality with the highest mean income in each region we are going to sort the data by region and by decreasing mean income. Then, with the sample tool, we group by region and we select the first entry.
To create the black frame around the municipality with the highest income we use tools from the Spatial toolbox.
We proceed like this:
- Use a Spatial Info tool to create the bounding rectangle around the spatial polygon of the municipality
- Use a second Spatial Info tool to calculate the "length" of this bounding rectangle (the length of a polygon is defined as its perimeter)
- Use the Buffer tool to create a buffer around this bounding rectangle, with a size equal to the perimeter divided by 100
By doing this, we will create a rectangle around the municipality that will be a bit larger than the polygon itself, which is visually more attractive.
Finally, we create a new polygon layer in the Report Map Tool (Layer Tab), source #2, and name it "Highest mean income". In the Theme menu we choose no fill color, a thick black outline and 100% opacity.
Let's finalise this map
We still miss a title! We can create a title with the Report Text tool (which also allows text formatting, adding hyperlinks and images). Then we join it with the union tool, using manual configuration to force the text and the map in the same column and taking care that the title comes first in the specific output order. Finally, we use the Layout tool to associate the title and the map and we save the whole in pdf by using the Render Tool.
And now you can admire the result!
You have now learned how to visualise the mean gross income with only a couple of tools. Next time we propose to demonstrate the power of the predictive tools on a case of churn in the Telco industry. Stay in touch!