kohera-logo-regular.svg

World Cup Russia: Calculating the travel distance with spatial data

As I start to learn more about SQL, I came across a subject that was new to me: spatial data. I was curious on how it worked so I started looking some things up.

How many kilometers must the Belgium football team travel to play their matches?

After I read some documentation, I started thinking on how spatial data could be used with some ‘real life’ examples. As it happens, I created a fun dashboard in Power Bi with my colleague about the upcoming World Cup in Russia. We used some geographical data there. More specifically, the location of the stadiums of the World Cup in Russia. Now that the schedule of the matches is also out, I thought it might be a good idea to calculate something. For example: how many kilometers must the Belgium football team travel to play their matches?

The base camp of the Belgian football team is in Moscow (more specifically the Moscow Country Club Hotel). They have matches in Kaliningrad (Kaliningrad Stadium), Moscow (Spartak Stadium) and Sochi (Fisht Olympic Stadium). Through the dashboard me and my colleague created, I already had the longitude and latitude of the stadiums. Now all I have to do, is to create the SQL statement.

This query calculates the distance between all the locations. Start of in basecamp and goes to the stadium and back. This is done for every match. The result of the query is:

Apparently, the Belgian football team has to travel 6008,97 km’s (!!) in total. Let’s hope that doesn’t impact their chances on winning the World Cup!

DSC_1388
Aggregaties
Power BI Desktop is een prachtige tool om snel data-analyses te kunnen uitvoeren. Je connecteert op een databron, importeert en...
dba image
DBA is not that scary
Often when talking to people who are looking for a career path in the data world I feel like there...
blog-2303
How do you link an SCD Type 2 table in Power Query?
This article uses a simple example to demonstrate how to link an SCD Type 2 table in Power Query to...
featured-2302
How to easily parse JSON in Power BI Desktop
Sometimes you want to use JSON data in Power BI. And sometimes Power BI doesn’t exactly do what you want...
header-2301
Power BI reports as monitoring tool
Who has not created monitoring reports or beautiful dashboards in Power BI? Would it not be great to show off...
your-modernization-journey-starts-now-header
Your Modernization Journey starts now
Recently Microsoft introduced SQL server 2022. We wrote this post to make sure you won’t be missing out on all...