kohera-logo-regular.svg

World Cup Russia: Calculating the travel distance with spatial data

Vector_BG.png

World Cup Russia: Calculating the travel distance with spatial data

Vector_BG.png

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!

Photo of successful woman coder hacker web creator sitting armchair comfortable workspace workstation indoors.
The hurdles and pitfalls of moving or migrating a System-versioned temporal table cross database
Maybe you already have your own way of doing this and are wondering about alternative methods, or maybe you are...
Group of computer programmers working in the office. Focus is on blond woman showing something to her colleague on PC.
Updating your Azure SQL server OAuth2 credentials in Power BI via PowerShell for automation purposes
The better way to update OAuth2 credentials in Power BI is by automating the process of updating Azure SQL Server...
2401-under-memory-pressure-featured-image
Under (memory) pressure
A few weeks ago, a client asked me if they were experiencing memory pressure and how they could monitor it...
2402-fabric-lakehouse-featured-image
Managing files from other devices in a Fabric Lakehouse using the Python Azure SDK
In this blogpost, you’ll see how to manage files in OneLake programmatically using the Python Azure SDK. Very little coding...
2319-blog-database-specific-security-featured-image
Database specific security in SQL Server
There are many different ways to secure your database. In this blog post we will give most of them a...
kohera-2312-blog-sql-server-level-security-featured-image
SQL Server security made easy on the server level
In this blog, we’re going to look at the options we have for server level security. In SQL Server we...