MIP Logo

Workout Wednesday #10 2020 ~ Using BUFFER() to find the nearest London Pub

This post was originally published on The Data School blog between 2018 and July 2025, before our program was renamed to MIP’s Analytics Career Accelerator. References throughout this article to “The Data School” or “DS” all refer to what is now MIP’s Analytics Career Accelerator. The program, its people, and its commitment to launching outstanding analytics careers remain the same – just under a new name.

If you are having trouble viewing this article, please report it here. 

Today we worked on a WOW Challenge that I found very useful in applying spatial data. The challenge is simple, replicate the below image. More importantly, it makes a great use case of the buffer() function and demonstrates many practical implications. Moreover, in this post, I will highlight the 3 key components for completing this challenge.


1. Firstly, Data needs to be joined

A common mistake is to join the data by a common variable i.e ID or neighbourhood. However, in this challenge, you will need to create an intercept as the join. In summary, what this join is doing, is finding the pubs that reside within the hotel perimeter of 500m.

2. Next, recreate the points and buffer again as a calculated field. 

This will allow the points to be quantified within Tableau, as they currently only exist as Latitude and Longitudes.

This will create a 500m buffer around the hotels.


And similarly, this will create pub points.

 

3. Finally, putting it all together!

All that is left is putting all the pieces together. To get the number in the circles, I used Count Distinct for Pubs within the 500m Buffer Marks card.

Once again this is a great challenge that demonstrates a strong use case for spatial data integration. Going beyond the challenge we can include distance(hotel, pub) to work out the exact distance between the points. For instance, we can further use this example to identify clients within 500m of a supermarket or even find the nearest dentist!

 

Share this post