8 min read

 

This blog aims to illustrate the power of spatial analysis in optimizing business decisions. First, we will introduce what spatial analysis is, and discuss some common use cases. Then, we will demonstrate how spatial analysis can add value to your business through a case study using Alteryx.

 

Contents

  1. What is Spatial Analysis
  2. Case Study

 

1. What is Spatial Analysis

Spatial analysis is the process of modelling and solving problems using spatial features. Spatial features include geographic objects and their associated geometric properties. For example, the location (longitude and latitude) of a store, the distance between two customers, and the area bounding a sales region are all spatial features. Spatial analysis has a wide range of applications, and some common use cases include:

  1. Personal Use Cases:
    • Which schools are within a 5km radius from my house?
    • What is the optimal route for shopping at 5 different stores?
  2. Business Use Cases:
    • What is the optimal location for a new store to maximize customer exposure?
    • How many transmission towers are needed to cover the required service area?

 

 

2. Case Study

Spatial data can be abstract and difficult to work with. However, Alteryx makes it efficiently to model and solve spatial problems!

To demonstrate, we will borrow an example from the Alteryx Weekly Challenges (Weekly Challenge #129). The problem is as follows:

“You are hosting a lunch event and you have 5 possible locations. Your task is to choose the location that minimizes the overall cost (accounting for the benefit) to the company and report the cost.

 

Assumptions
– A person will only come if the location is under 10 miles from their location.
– The benefit of a person coming to the event is $20.
– The cost of a “missed opportunity” (people you must turn away after capacity is reached) is $5. Note that this only applies to those under 10 miles from the location.”

Ready? Let’s begin!

Overview of Workflow

Overview of Workflow

 

 

Step 1Creating Spatial Point Objects From Venue and Customer Latitude and Longitude

Both the Locations and Customers tables contain latitude and longitude information, we can create Spatial Point Objects from these two fields.

 

  1. From the Spatial Palette, drag the Create Points Tool onto the Canvas.
  2. Connect the Create Points Tool to the Customers table.
  3. Check the X Field (Longitude) and Y Field (Latitude) are populated with the correct values from the Customers table.
  4. Repeat 1-3 for the Locations table.

If we connect a Browse Tool to the Customers table and run the workflow, we will see customers locations appear as square points on the map.

 

 

Step 2: Create a 10 Mile Radius for the Venues
  1. From the Spatial Palette, drag Trade Area onto the Canvas.
  2. In the configuration window, change the Specific Value for radius to 10, since a customer will only attend if they are within 10 miles from the venue.

If we connect a Browse Tool to the Trade Area output and run the workflow, we will see that the venues now cover a 10 mile radius.

 

 

Step 3: Match Customers Who Are Within 10 Miles of the Venue
  1. From the Spatial Palette, drag the Spatial Match Tool onto the Canvas.
  2. Connect the Trade Area output to the Target Anchor, and the Customers spatial point to the Universe Anchor of the Spatial Match Tool.
  3. Set the matching condition to “Where Target Contains Universe“, so that we only return customers who are within the 10 mile radius of each of the venues.
  4. Keep only the necessary fields by deselecting those fields that we no longer need. 

 

 

Step 4: Calculate the Total Number of People Who Would Attend Each Venue
  1. From the Transform Palette, drag the Summarize Tool onto the Canvas.
  2. Group By Location, Capacity, and Price fields, and Sum the People field. This will give us the total number of people who would attend each venue (those who are within 10 mile radius from the previous step).

 

 

Step 5: Calculate the Number of Attendees, Added Value and Costs
  1. From the Preparation Palette, drag the Formula Tool onto the Canvas.
  2. Create new fields including Attendees, Added_value and various costs as shown below.

The results are as follows:

 

 

Step 6: Keeping Only the Useful Fields
  1. It is good practice to drop fields that we no longer need, as this will reduce the size of our data and make the workflow more efficient. We can do so using the Select Tool.

 

 

Step 7: Sorting the Venues by Net Cost
  1. From the Preparation Palette, drag the Sort Tool onto the Canvas.
  2. In the configuration window, select the Net Cost field and sort it in Ascending order (lowest cost to highest cost).

The results are as follows. We can see that the there is almost a $7,000 difference between the least expensive and most expensive venue!

 

 

Step 8:  Extract the Least Expensive Venue
  1. From the Preparation Palette, drag the Sample Tool onto the Canvas.
  2. Select First N Rows and set N = 1 to extract the first row of the data, which is the least expensive (lowest net cost) venue.

 

The final result is as follows:

 

As we have seen, using Alteryx, we were able to solve a complex business problem using the powerful spatial analysis tools and some data preparation tools in just 8 steps!

 

 

 

 

Martin Ding
Author: Martin Ding