Find Bordering Countries in Alteryx

by Jack Turner

Last week during a Dashboard week challenge about life expectancy around the world, I wanted to compare each country to its neighbours. As the data didn’t include which countries bordered each other, I had to find out using Alteryx. Although I wrote a bit about this in my blog, I didn’t have time to properly explain how I did it, so here I will break it down step by step.

First you need to input a shapefile of the countries that you are interested in. In my case it was the whole world.

Next we are going to use the Buffer tool. This tool increases the size of each country’s polygons by a given number of miles. The idea is that by increasing the size of each polygon, the countries will overlap onto their bordering countries. A one mile buffer should do the job. Make sure you tick the ‘Include in Output’ box, as we need both the original shape field and the new buffer shape field for a later step.

Just to make the next step a bit easier to follow, I then did some renaming using the Select tool.

Now we can use the Spatial Match tool to find those bordering countries. This tool has two inputs, a Target Input (T) and a Universe Input (U). We have to connect the original country shape field to T and the buffer shape field to U.

And with that, it’s basically done.

All that’s left is some renaming and removing of unnecessary columns.

You’ll notice that every country is included as a bordering for itself, so Zimbabwe is listed as a bordering country of Zimbabwe. During my project this was actually useful for the data visualisations I was creating in Tableau, but if you want to remove these, you can use the Filter tool.

While this technique won’t capture islands with neighbouring nearby islands, it’s pretty effective for countries with land borders.

TGI Dashboard Friday

1 mins read

Fri 06 Mar 2020

Day 4 of Dashboard Week: An End in Sight

2 mins read

Thu 05 Mar 2020

Third Day of Dashboard Week

2 mins read

Wed 04 Mar 2020

Second Day of Dashboard Week

2 mins read

Tue 03 Mar 2020