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!