Latitude and Longitude Explained
On this page
Problem statement
Latitude and longitude look like ordinary x and y numbers, and treating them that way causes most of the mistakes in spatial data: distances in degrees, buffers that are ellipses, points swapped into the ocean, hemispheres lost in conversion. They are angles. Latitude is measured from the equator, longitude from the Greenwich meridian, both on an ellipsoid that approximates the Earth, and the ground distance a degree represents depends on where you are and which way you go.
This page explains what latitude and longitude measure, with numbers from real data: the length of a degree of latitude and of longitude at different latitudes, computed on the WGS84 ellipsoid; how the world's airports from OurAirports are distributed between the hemispheres; the conventions for signs and ranges; and the difference between the geodetic latitude in GPS data and the geocentric latitude of a sphere.
Quick answer
Latitude is the angle north or south of the equator (−90° to 90°); longitude the angle east or west of Greenwich (−180° to 180°). A degree of latitude is about 111 km everywhere; a degree of longitude is 111 km times the cosine of the latitude:
for lat in (0, 30, 45, 60, 80):
ns = geod.inv(0, lat - 0.5, 0, lat + 0.5)[2] / 1000
ew = geod.inv(-0.5, lat, 0.5, lat)[2] / 1000
print(f"at {lat:>2}°: 1° of latitude = {ns:6.2f} km; 1° of longitude = {ew:6.2f} km (111.32 x cos = {111.32 * np.cos(np.radians(lat)):6.2f})")
at 0°: 1° of latitude = 110.57 km; 1° of longitude = 111.32 km (111.32 x cos = 111.32)
at 30°: 1° of latitude = 110.85 km; 1° of longitude = 96.49 km (111.32 x cos = 96.41)
at 45°: 1° of latitude = 111.13 km; 1° of longitude = 78.85 km (111.32 x cos = 78.72)
at 60°: 1° of latitude = 111.41 km; 1° of longitude = 55.80 km (111.32 x cos = 55.66)
at 80°: 1° of latitude = 111.66 km; 1° of longitude = 19.39 km (111.32 x cos = 19.33)
A degree of latitude grows slightly from 110.57 km at the equator to 111.66 km at 80°, because the ellipsoid is flatter near the poles. A degree of longitude shrinks from 111.32 km at the equator to 55.80 km at 60° and 19.39 km at 80°; the cosine rule is within 0.4% everywhere.
Signs, axis order, geodetic latitude
1. Signs and hemispheres
North and east are positive, south and west negative. Count the world's airfields by hemisphere:
q = pd.crosstab(np.where(A.latitude_deg >= 0, "north", "south"), np.where(A.longitude_deg >= 0, "east", "west"))
print(q.to_string())
print(f"latitude range {A.latitude_deg.min():.2f} to {A.latitude_deg.max():.2f}; longitude range {A.longitude_deg.min():.2f} to {A.longitude_deg.max():.2f}")
col_0 east west
row_0
north 20686 35033
south 6791 10093
latitude range -90.00 to 83.09; longitude range -179.88 to 179.98
Most of the world's airfields are in the north-western quadrant, 35,033, dominated by North America; the southern-eastern quadrant has the fewest, 6,791. The southernmost place is at -90.00: an airfield at the South Pole.
2. Order: latitude, longitude or x, y?
Writing conventions put latitude first, "40.64, -73.78"; most GIS software and file formats put longitude first, as x. A swap is detectable when a value exceeds 90:
swapped_detectable = (A.longitude_deg.abs() > 90).mean()
print(f"airfields with |longitude| > 90°, where a swap would be impossible as latitude: {swapped_detectable:.0%}")
print("GeoJSON and shapely: (lon, lat); EPSG:4326 axis order: (lat, lon); pyproj with always_xy=True: (lon, lat)")
airfields with |longitude| > 90°, where a swap would be impossible as latitude: 41%
GeoJSON and shapely: (lon, lat); EPSG:4326 axis order: (lat, lon); pyproj with always_xy=True: (lon, lat)
41% of airfields have a longitude beyond ±90°, which cannot be a latitude, so a swap of the two would be detectable for them; for the rest it would produce valid, wrong coordinates. Libraries disagree on the order: GeoJSON and shapely use longitude first, the EPSG definition of EPSG:4326 latitude first.
3. Geodetic and geocentric latitude
GPS latitude is geodetic: the angle between the equatorial plane and the perpendicular to the ellipsoid. Geocentric latitude, the angle at the Earth's centre, is smaller. The difference peaks at 45°:
f = 1 / 298.257223563
e2 = f * (2 - f)
for lat in (0, 15, 30, 45, 60, 75, 90):
gc = np.degrees(np.arctan((1 - e2) * np.tan(np.radians(lat)))) if lat < 90 else 90.0
print(f"geodetic {lat:>2}°: geocentric {gc:8.4f}°, difference {lat - gc:.4f}° = {(lat - gc) * 111.1:.1f} km")
geodetic 0°: geocentric 0.0000°, difference 0.0000° = 0.0 km
geodetic 15°: geocentric 14.9041°, difference 0.0959° = 10.7 km
geodetic 30°: geocentric 29.8336°, difference 0.1664° = 18.5 km
geodetic 45°: geocentric 44.8076°, difference 0.1924° = 21.4 km
geodetic 60°: geocentric 59.8331°, difference 0.1669° = 18.5 km
geodetic 75°: geocentric 74.9035°, difference 0.0965° = 10.7 km
geodetic 90°: geocentric 90.0000°, difference 0.0000° = 0.0 km
Geodetic and geocentric latitude agree at the equator and the poles and differ most at 45°, by 0.1924°, about 21 km on the ground: using a spherical latitude formula on GPS data at mid-latitudes puts the point that far out.
How wide a degree cell really is
The data used on this page
Every open place in OurAirports, a public-domain database, with coordinates in WGS84 decimal degrees; lengths of degrees come from pyproj.Geod on the WGS84 ellipsoid.
from pathlib import Path
import numpy as np
import pandas as pd
import requests
from pyproj import Geod
Path("data").mkdir(exist_ok=True)
p = Path("data/airports.csv")
if not p.exists():
r = requests.get("https://davidmegginson.github.io/ourairports-data/airports.csv", timeout=300)
r.raise_for_status()
p.write_bytes(r.content)
A = pd.read_csv(p, keep_default_na=False, na_values=[""])
A = A[A.type != "closed"].reset_index(drop=True)
geod = Geod(ellps="WGS84")
print(f"{len(A):,} places; WGS84 semi-major axis {geod.a:,.1f} m, flattening 1/{1 / geod.f:.6f}")
72,603 places; WGS84 semi-major axis 6,378,137.0 m, flattening 1/298.257224
The places are in WGS84, whose ellipsoid has a semi-major axis of 6,378,137 m and a flattening of 1/298.257224.
Example 1: the longitude extent of a "square" degree cell
A grid of 1° cells is not a grid of squares. Compute the ground area of a 1° × 1° cell at several latitudes:
from shapely.geometry import box
for lat in (0, 30, 60, 80):
area = abs(geod.geometry_area_perimeter(box(0, lat, 1, lat + 1))[0]) / 1e6
print(f"1° cell from {lat}° to {lat + 1}°: {area:,.0f} km²")
1° cell from 0° to 1°: 12,309 km²
1° cell from 30° to 31°: 10,642 km²
1° cell from 60° to 61°: 6,123 km²
1° cell from 80° to 81°: 2,058 km²
A 1° by 1° cell covers 12,309 km² at the equator, 6,123 km² at 60° and 2,058 km² at 80°: a grid in degrees is far from equal-area, which matters for any count or density per cell.
Two angles on an ellipsoid
Latitude and longitude locate a point by two angles on a reference ellipsoid. Latitude runs from 0° at the equator to 90° at the poles, positive north; lines of equal latitude, parallels, are circles that shrink towards the poles. Longitude runs from 0° at the Greenwich meridian to 180° east and west; lines of equal longitude, meridians, all meet at the poles. Because meridians converge, the east-west distance covered by a degree of longitude falls with the cosine of the latitude, from 111 km at the equator to nothing at the poles, while a degree of latitude stays about 111 km, slightly longer near the poles because the ellipsoid is flatter there.
Coordinates also depend on the datum: the ellipsoid and its position relative to the Earth. WGS84, used by GPS, and the regional datums NAD83 and ETRS89 differ by about a metre or less today; older datums such as NAD27 or OSGB36 differ by tens to hundreds of metres. A coordinate pair without its datum is ambiguous at that scale. And because latitude and longitude are angles, distance, area, buffers and averages need spherical or ellipsoidal methods, or a projection to metres, before they mean anything.
0-360 longitudes, poles and the antimeridian
- 0–360 longitudes: some climate and ocean data use 0° to 360°; convert with
((lon + 180) % 360) - 180. - Poles: at the poles longitude is undefined; any value describes the same point.
- The antimeridian: −180° and 180° are the same meridian; ranges and averages that cross it need care.
- Altitude: a third coordinate, ellipsoidal or orthometric height, completes the position.
Internal links
- How many decimal places do coordinates need? — precision in decimal degrees
- How to calculate the distance between two coordinates in Python — distances from angles
- Great circle and rhumb line explained — paths between two coordinates
FAQ
What is the difference between latitude and longitude?
Latitude is the angle north or south of the equator, from −90° to 90°; longitude is the angle east or west of the Greenwich meridian, from −180° to 180°.
How many kilometres is one degree?
One degree of latitude is about 111 km; one degree of longitude is 111 km times the cosine of the latitude, about 79 km at 45° and 56 km at 60°.
Which comes first, latitude or longitude?
In writing usually latitude; in GIS software, GeoJSON and shapely, longitude first as x.
Are GPS coordinates and map coordinates the same?
GPS gives WGS84 geodetic coordinates; maps may use another datum or a projection, so check the CRS.