In the real world, latitude and longitude play an important role in several fields and calculations, but one of their most common uses is measuring distances between points. As a data company, we want to see our customers use this calculation to improve efficiencies in their business.
In fields like logistics, transportation, air travel, and more, these calculations deliver a key component for examining the fastest, shortest, and most efficient routes between two locations. As a data and analytics company, we help companies visualize this information in dashboards, and it is used by managers to make better decisions on delivery times, destinations, and providers.
Today, the calculation used for this is mostly handled digitally, by programs and algorithms designed specifically to uncover the answer. Even so, understanding the basics behind the concept and comprehending how the math works is vital to ensuring that you understand exactly how to calculate distance using latitude and longitude. In this blog, we want to start with the basics and go through how it works. We’ve included links to some of our customer case studies, and some example dashboards, for those who want more.
Latitude and longitude basics
Latitude and longitude are coordinates system that let anyone determine the location of a single point on any part of the earth’s surface. Latitude refers to the angle of a given point measured from the equator and with a vertex at or near the center of the earth (depending on the type of latitude measured). As you move north or south, the latitude will increase from 0° to 90.
See Sisense in action:
Longitude is a similar measure, although it measures location to the east or west of the prime meridian—the imaginary line that connects the north and south poles and crosses Greenwich, London. The calculation for longitude uses the angle made from a line that goes from the earth’s center to the intersection of the prime meridian and the equator and then extends east or west. Unlike latitude, however, the earth’s longitude at both east and west reaches 180°.
How to calculate distances using longitude and latitude
One of the most common ways to calculate distances using latitude and longitude is the haversine formula, which is used to measure distances on a sphere. This method uses spherical triangles and measures the sides and angles of each to calculate the distance between points. It was traditionally utilized in pre-digital navigation and is based on calculations that take into account the earth’s radius, as well as the fact that on a sphere shapes are different from their flat counterparts. Namely, spheres do not have parallel lines, and lines are considered “great circles” so any two lines will intersect at two points.
See Sisense in action:
These equations can be carried out manually—with some difficulty—but today, there are several easy ways to calculate distances digitally, assuming you have the correct data, to begin with. This includes knowing the start and end point (they can be the cities, streets, or even smaller distances), as well as the geographical coordinates of each point. For example, if you measured the distance between New York and Tokyo, their respective coordinates would be as follows:
- New York (latitude 40.7128°N, longitude 74.0060°W)
- Tokyo (latitude 35.6895°N, longitude 139.6917°E)
Keep in mind that for calculation purposes, southern latitudes can be expressed as negative numbers, as can western longitudes. With these numbers in hand, you can plug them into the haversine formulae,
a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)
c = 2 * atan2( √a, √(1−a) )
d = R * c
Where φ represent the latitudes, and λ represent the longitudes.
Alternatively, you can use a latitude and longitude calculator, which uses an algorithm based on the formula to find the distance.
What is the calculation useful for?
In the pre-GPS and computer days, the haversine formula was a vital aspect of finding the most efficient distance between two points. Today, this calculation is still important, and it plays a major role in several industries.
For logistics, where distance and time can be the difference between profits and losses, finding the shortest possible point between two locations can greatly improve travel times and reduce wasted resources. More importantly, it can help calculations that feature several moving parts. For instance, an airline that has to fly between two locations with a layover can find the most efficient path to fly, reducing jet fuel use, time that a single airplane is occupied, and increase the number of flights possible in a day. Even for delivery services, it can assist companies with planning the best possible routes for their teams to travel while reducing overall transit times, improving delivery speeds, and generating revenues.
While pen and paper calculations are time-consuming—and not entirely necessary—understanding how to calculate distances using latitude and longitude can help any company identify better routes to cut down the distances their planes, ships, cars, and teams must travel.
Learn how Sisense helps companies grow:
CTSI Analyzes Visual Data to Track Shipping Trends