## Alteryx Spatial Tools - Part 2 - Distance, Spatial Match & Trade Area

by Liu Zhang

Continue with previous blog post, we will do the same exercise with some news tools, as it is often the case where we have more than one way to reach the same results.

We will start the exact same input data, only this time we will connect with Trade Area tool with The Information Lab's office address.

This tool will create a circular region (i.e. trade area) around a point with a given radius, we will use this to area to match the schools.

Within the configuration window, we only need to specify the radius and the units, I used 5km here just to restrict the search radius.

Note: Drivetime is not-available by default, additional paid package need to be installed

Note: There is another tool, Buffer that can also create an circle, but we will skip it in this series.

Once we have an area created, we could use it as reference to do Spatial Match, which there is a tool does exactly as the name suggest.

In the previous blog, I have mentioned about Target and Universe and there is a detailed Alteryx description available as well. The essential ideas can be described in the flow chart.

In the case of Find Nearest tool, the order matters, but here for Spatial Match tool, it is in fact less so. As we can see, Intersects is the default/first choice which works most of the time, while Contains and Within are opposite of each other for a given Target and Universe link, but a simple switch of connect to Target and Universe anchor will effectively switch Contains to Within.

Therefore in the above workflow I preserved notation used from Part 1, where Target is the area of reference, Universe are the Points to be matched.

The Spatial Match tool is configured to use The Information Lab's office as center, then a circle of radius 5km as catchment area, to find all schools that are within the region. Let's have a look at the output to see what the tool did.

From the results pane, we can see for each school (row of data), we have The Information Lab's office address (Office Location) and School address (School Location), then we should be able to calculate the distance between each of those pair of address (point object) and the tool for it is Distance tool.

Let's have a look at the configuration for Distance tool

Again the tool requires the minimal amount of configuration, where the default setting is usually the best choice.

Once we connect it to the M(atch) anchor on the Spatial Match tool, we will get the following output.

Alteryx calculated the distance between each pair of address through Pythagoras formula. This is almost the results we want, we can sort by distance, then filter to the top three to get the answer for What is the three closest school to The Information Lab's office.

As much as people may not be interested in the school placement, the problem can be quickly modified to ask about open a shop location where the three closest competitors are located, or the distance to the three logistic distribution centers.

We can see the power of Alteryx in it's simplicity for the spatial analysis, where we can quickly get some essential information for the question that we would like to be answered.

Follow the blog post updates for more examples on other spatial tools.

Looking for more guides, tips and tricks in Tableau or Alteryx? Go check out the other blog posts from the Data School.

Tableau Public