In this blog, we will examine some of Alteryx’s spatial tools through one of the weekly challenges from the Alteryx Community page. I have chosen Challenge #199: Let’s all go to the movies! – Alteryx Community

This challenge involves finding the top three movie theatres closest to the homes of a group of friends and creating a map of those locations. The following steps will guide you through completing this challenge.

Step 1: Create points 

Once you have downloaded the start file from the challenge link above, the first step would be to drag two Create Points tool and connect it to the input tools that contains longitude and latitude as x and y coordinates. This tool creates a centroid point for all the locations for our map visualization. 

We can see that Alteryx has easily identified the Longitude and Latitude as our desired values and auto-populates the X and Y Fields.

Step 2: Append centroids

Next, using the Append Fields tool, we will connect the Theatre Locations to the target (T) and the Friends Locations to the source (S). Unselect all the fields containing Latitude and Longitude, and rename the centroids as displayed in the configuration window below.

The Append Fields tool will add all the columns from the Friends Locations to every row in Theatre Locations.

Step 3: Find the distance between homes and theatres

Next, find the distance between the home locations and the theatres. Using the Distance tool, find the distance between two points. Set the values for the centroid source and destination as below and uncheck Output Cardinal Direction.

Step 4: Summarize by total distance

The next step is to find the total distance using the Summarize tool. We can do this by configuring the Summarize tool to group the rows by Theatre Name and sum the DistanceMiles. Select the First summary action for Theatre Centroid to get the first record.

Step 5: Sort by ascending distance

Next, you need to use the Sort tool to sort the Sum_DistanceMiles in ascending order to identify the closest theatres.

Step 6: Select the closest theatres

After sorting, use the Sample tool to pick the top 3 rows. Use the Select tool to drop the centroid column. 

Use the Select tool to drop the centroid column.

Using the Browse tool, we can view the results containing the top 3 closest theatres and the first part of the challenge is complete.

Step 7: Create a map

The final step of the challenge is to create a map using the Map tool that we can drag in from the Report palette.

Change the Reference Base Map to Light – Most Recent Vintage in the Settings tab.

Change the spatial field and label field values for Incoming Connections #1 to First_Theater Centroid and Theater name. 

Repeat the same for Incoming Connections #2.

Add a Points Layer for connections #1 and #2.

Rename the layer name to update the legends.

You can also format the style of your map points as per your preference. Finally, using the Browse tool, you can view the map.

We have now completed our challenge.

Thanks for taking the time to read this step-by-step walkthrough!

 

Icon attribute: <a href="https://storyset.com/user">User illustrations by Storyset</a>
The Data School
Author: The Data School