Now that it's live, don't forget to accept your certification badge on Credly today! Learn more here.
We are currently experiencing an issue with Email verification at this time and working towards a solution. Should you encounter this issue, please click on the "Send Verification Button" a second time and the request should go through. If the issue still persists for you, please email for assistance.

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

Create a Map Book with Spatial Clustering


Generic test data for demonstrating the processGeneric test data for demonstrating the process

One of the perennial challenges of creating high-quality maps is working with data sets where the spatial data is too spread out to make a useful map. The general solution for this challenge is to create a Map Book. A Map Book is a series of maps that show a subset of the data at amore detailed resolution. To create a Map Book in Alteryx, we bring our data into the Report Map tool with a Grouping Field, which will allow the tool to create a separate map for each group.

What happens when there is no grouping field in the data, or the grouping field does not group spatially?

Well, we have to create a spatial grouping field.

To do this, we'll dip into the Predictive Grouping toolset and use the K-Centroids Cluster Analysis tool combined with the Append Cluster tool to dynamically create a number of clusters based on their Latitude and Longitude. This is set up as below:

The workflow level view of creating spatial clustersThe workflow level view of creating spatial clustersIn this example the dataare saved as spatial points. To perform cluster analysis we need to have Latitude and Longitude as separate numeric columns, so we use the Spatial Info tool to get the Lat/Long. The K-Centroids Cluster Analysis tool is the key to this workflow. In the configuration of the K-Centroids Cluster Analysis tool, we will use only the Lat/Long fields(in this case they are labeled as CentroidX and CentroidY because of the Spatial Info tool)as the selected Fields for cluster analysis. Using K-Means as the clustering method is appropriate for this use case, as it will create clusters based on the euclidian distance between points. There will be some adjustment required on the Number of Clusters setting, but this can be done automatically with an Iterative Macro(stretch goals!).

Cluster ID's are joined to the dataCluster ID's are joined to the data

Once we connect the Append Cluster tool and run the workflow, cluster labels generated by the K-Centroids Cluster Analysis Tool are added to our data stream, giving each row a group number. These clusters are now available for use in the Report Map tool.ProTip: When using the Report Map tool it is hugely helpful to rename your inputs. This is because the name of the input is populated in the tool's configuration. Knowing the name of the input makes it easy to know which layer you are working with. You can rename your input by clicking on the text that populates in the connection between your data stream and the Report Map Tool (by default the name is typically the number of the connection, e.g., "#1")

Rename your inputs!Rename your inputs!

Now, you can use the Cluster Field as your Grouping Field in your Report Map Tool!

Now the grouping field is Spatial!Now the grouping field is Spatial!

Taking it Further

If you want to control your extent separately from your data layers, you can create an extent polygon and use that as your zoom and grouping layer. This takes a couple of extra tools and a slightly different configuration in theReport Map tool.

We create the clusters the same way as before, but this time, we add the Poly-Build tool and create a Convex Hull polygon using the Cluster as the Group Field. Then we can use the Spatial Info tool again to get the Bounding Rectangle as a Polygon which we can Buffer to get a little bit of space around the points.

Create your own dynamic extent featureCreate your own dynamic extent featureNow you have your own extent feature.

The odd shapes are the Convex Hull polygons, and the squares are the Extent polygons ready for use in the Report Map toolThe odd shapes are the Convex Hull polygons, and the squares are the Extent polygons ready for use in the Report Map toolWe can finish this up by bringing the polygons into the report map tool. The changes that need to be made are as follows: In the Settings, change the Expand Extent to 0% because that's being done with the Buffer tool. Under Data, we can remove Grouping on every layer except for the Extent layer. In the Layers tab, we make sure that we're Zooming to the Extent Layer only and Setting it's opacity to 0 (we don't need to see it). We also un-check Show in Legend.

Now you have two methods to dynamically create Map Books with Alteryx!

For more information please see the following articles or check out the attached workflow:

Tool Mastery | K-Centroids Cluster Analysis

Tool Mastery | Report Map

No ratings
12 - Quasar
12 - Quasar

As a GIS Professional, I love this!  Great work, and awesome way to utilize the K-Centroids Cluster Analysis and the Append Cluster tools!



8 - Asteroid

@StephenR Great article Stephen.  Just wondering if it's possible to cluster data evenly among groups?


Hello @bertal34,


That is possible. What you would need to do would be to create an iterative macro that adjusts the number of clusters until the number of rows/cluster becomes evenly distributed. I would not expect it to be perfect every time because there will almost always be some outliers that don't fit well in a cluster, but that would probably get you the closest.