Frank Chen

Collecting stories by foot, lens, and occasional propeller

← Back to Posts

Part 2: Coordinate systems and Euclidean distance

Euclidean distance is easy to compute, but only if the coordinates are in a suitable projected coordinate system. This tutorial explains British National Grid, latitude/longitude, and a worked Euclidean-distance example.

Tutorials 8 Mar 2026

Euclidean distance is the simplest way to measure separation between an origin and a destination. In a spreadsheet, it looks straightforward: subtract the coordinates, square the differences, add them together, and take the square root.

That calculation only makes sense if the coordinates are expressed in compatible planar units.

This is why coordinate systems matter.

1. Why a coordinate system matters

A coordinate system tells us how locations are represented numerically.

If two points are recorded in metres on a projected grid, Euclidean distance can be calculated directly. If the same points are recorded as latitude and longitude in degrees, the calculation is no longer a simple Pythagorean problem.

So before calculating distance, we need to ask:

  • what coordinate system are the data in?
  • are the units metres or degrees?
  • are both datasets using the same system? If the answer to the last question is no, the distance calculation is not yet valid.

2. Geographic coordinates: latitude and longitude

Many GPS devices, phones, and global spatial datasets use WGS84 latitude and longitude, also known as EPSG:4326.

Latitude tells us how far north or south a place is from the Equator. Longitude tells us how far east or west a place is from the Prime Meridian.

Some example locations are:

PlaceLatitudeLongitude
Leedsabout 53.80about -1.55
Singaporeabout 1.29about 103.85
Buenos Airesabout -34.60about -58.38
Tromsoabout 69.65about 18.96

These examples show why latitude and longitude are useful. They provide a global way to describe position without relying on any one country’s national mapping grid.

These numbers are measured in degrees on the curved surface of the Earth.

Extreme cases

Latitude and longitude become especially interesting near geographic extremes.

  • At the Equator, latitude is 0 degrees.
  • Near the International Date Line, longitudes such as 179.9 degrees east and 179.9 degrees west are numerically very different but geographically very close.
  • Near the poles, the meridians converge. This means the physical distance represented by one degree of longitude becomes very small.
  • At the exact North Pole or South Pole, longitude is effectively ambiguous because every direction away from the pole is south or north. This is one reason latitude and longitude are not well suited to simple planar distance calculations. A degree is not a fixed metric unit in the way that a metre is.

That creates an important problem for Euclidean distance. One degree of longitude does not represent the same ground distance everywhere. The physical length of a degree changes with latitude, and near the poles it shrinks towards zero as the meridians converge.

As a result, you should not take latitude and longitude values from a spreadsheet and treat them as if they were x and y coordinates in metres.

Why latitude and longitude are still widely used

Despite that limitation, latitude and longitude remain extremely important because they are:

  • global rather than national
  • the natural output of GNSS and GPS devices
  • convenient for navigation, aviation, and shipping
  • a common exchange format for worldwide spatial data So latitude and longitude are often used to identify location, even if they are not the best coordinates for measuring Euclidean distance in a local study.

A historical note: navigation at sea

Historically, using latitude and longitude was not just a technical detail. It was a practical navigational skill.

In the age of ocean travel, mariners needed a way to describe where they were on the Earth without depending on local landmarks. Latitude and longitude provided that global language.

Finding latitude at sea was difficult but manageable. Navigators could estimate it from celestial observations, for example by measuring the height of the midday Sun or, in the Northern Hemisphere, the Pole Star.

Longitude was much harder. Before reliable marine timekeepers, sailors often had to rely on dead reckoning or complex astronomical methods, both of which accumulated error. That is why the longitude problem became so famous in maritime history.

The major breakthrough came with improved astronomical tables and marine chronometers such as John Harrison’s sea clocks, which made it much more practical to determine longitude at sea. So yes, this was very much a real navigational skill, and solving longitude was one of the great technical challenges of the sailing age.

3. Projected coordinates: British National Grid

For work in Great Britain, many official datasets use the British National Grid (BNG), identified as EPSG:27700.

This is not just an arbitrary technical standard. It was created to support national mapping.

Why this coordinate system exists

Before a single national grid was adopted, mapping in Britain involved multiple local projections and reference frameworks. That made it harder to build one consistent national map.

During the retriangulation of Great Britain in the 1930s, Ordnance Survey moved towards a single national datum, projection, and reference system. Official OS history describes this as part of the effort to unify mapping across Britain, and OS historical material identifies Brigadier Martin Hotine as the key figure leading that retriangulation work.

So it is most accurate to say that British National Grid was developed by Ordnance Survey as part of national remapping, with Martin Hotine playing a leading role, rather than treating it as the invention of a single person working alone.

What BNG does

The system combines:

  • the OSGB36 reference framework
  • a Transverse Mercator projection
  • easting and northing coordinates measured in metres In this system, locations are recorded as:
  • Easting
  • Northing Both are measured in metres.

A point might look like this:

  • Easting: 430000
  • Northing: 435000 Because the units are metres, the Euclidean formula now produces a result in metres as well. That makes BNG convenient for distance calculations in UK-based teaching exercises and retail analysis.

It also serves a broader practical purpose. British National Grid allows Ordnance Survey maps, infrastructure datasets, planning systems, utilities, and land-survey records to refer to the same places using one shared national grid.

Why online maps usually use projected coordinates, but not BNG

Here we need an important distinction.

Online maps usually do rely on projected coordinates internally, because a flat screen needs a flat coordinate surface. Once a map is tiled, zoomed, and panned, the software needs pixel and tile coordinates on a projected plane rather than raw latitude and longitude alone.

However, most online maps do not use British National Grid as their main display projection. Instead they usually use a global web mapping projection, most commonly Web Mercator.

The reason is practical:

  • British National Grid is designed for Great Britain, not the whole world
  • online basemaps need a single projection that works globally
  • tiled web maps work more easily when the projected map can be divided into square tiles So British National Grid is ideal for British national mapping and local analysis, while Web Mercator is more convenient for global online slippy maps.

Why British National Grid and latitude/longitude cannot be mixed

EPSG:4326 and EPSG:27700 cannot be mixed directly because they describe position in different ways.

  • EPSG:4326 uses angular coordinates in degrees on a global geographic system
  • EPSG:27700 uses projected grid coordinates in metres over Great Britain
  • they are based on different reference frameworks and different geometric logic That means the same real-world point can have two completely different numerical descriptions, one in latitude/longitude and one in easting/northing.

If you subtract a longitude value from an easting value, or a latitude value from a northing value, the result is meaningless. The numbers are in different units and different coordinate spaces.

So before measuring distance, both origins and destinations must be transformed into the same coordinate reference system.

4. The Euclidean distance formula

If origin ii has coordinates (Ei,Ni)(E_i, N_i) and destination jj has coordinates (Ej,Nj)(E_j, N_j), Euclidean distance is:

dij=(EiEj)2+(NiNj)2 d_{ij} = \sqrt{(E_i - E_j)^2 + (N_i - N_j)^2}

This is simply the Pythagorean theorem applied to easting and northing differences.

The formula measures the shortest straight-line distance between the two points in the projected coordinate plane.

5. Worked example

Suppose a postal-sector centroid and a supermarket have the following British National Grid coordinates.

LocationEastingNorthing
Postal sector430000435000
Store432500438000

Step 1: Calculate coordinate differences

ΔE=432500430000=2500 \Delta E = 432500 - 430000 = 2500 ΔN=438000435000=3000 \Delta N = 438000 - 435000 = 3000

The origin and store differ by 2500 metres east-west and 3000 metres north-south.

Step 2: Square the differences

25002=6,250,000 2500^2 = 6{,}250{,}000 30002=9,000,000 3000^2 = 9{,}000{,}000

Step 3: Add the squared values

6,250,000+9,000,000=15,250,000 6{,}250{,}000 + 9{,}000{,}000 = 15{,}250{,}000

Step 4: Take the square root

dij=15,250,0003905.12 d_{ij} = \sqrt{15{,}250{,}000} \approx 3905.12

So the Euclidean distance is approximately 3905 metres.

Step 5: Convert to kilometres

In retail analysis it is often easier to read distances in kilometres, so we divide by 1000:

distancekm=3905.1210003.91 \text{distance}_{km} = \frac{3905.12}{1000} \approx 3.91

The final result is 3.91 km.

6. Spreadsheet implementation

Suppose your spreadsheet columns are arranged as follows:

ColumnMeaning
Borigin easting
Corigin northing
Dstore easting
Estore northing

Then the Euclidean distance in metres can be calculated as:

=SQRT((B2-D2)^2 + (C2-E2)^2)

If you want kilometres directly, divide by 1000:

=SQRT((B2-D2)^2 + (C2-E2)^2)/1000

This is why the teaching spreadsheet divides the result by 1000. The coordinate system is in metres, but the preferred reporting unit is kilometres.

7. Common mistakes

Several errors appear repeatedly in beginner spatial analysis.

  • Mixing coordinate systems. If origins are in EPSG:27700 and stores are in EPSG:4326, the numbers are not directly comparable.
  • Treating latitude and longitude as if they were metres. Degrees are not constant-distance planar units.
  • Forgetting that Euclidean distance is straight-line distance, not route distance.
  • Rounding coordinates too aggressively before calculating distance. These mistakes can produce distances that look plausible at first glance but are analytically wrong.

8. What Euclidean distance does and does not tell us

Euclidean distance is useful because it is:

  • easy to compute
  • easy to audit
  • suitable for large origin-destination matrices in simple models But it also ignores the actual structure of the transport network. A river, motorway, railway line, or cul-de-sac system can make the real route much longer than the straight-line result.

So Euclidean distance is often a useful teaching measure and a reasonable first approximation, but it is not a literal description of most real journeys.

Further readings

Related tutorials on this site: