Latitude and longitude are the two numbers that define every point on Earth. Latitude tells you how far north or south you are. Longitude tells you how far east or west. Together they form a coordinate pair that any map, GPS device, geocoding API, or AI assistant can reason about.
Most developers use coordinates without thinking about them, until a bug surfaces. This guide explains what each one actually measures, the format conventions you will meet in production, and the swap that causes more map bugs than any other single mistake.
What Latitude Measures
Latitude is the angle, measured in degrees, between a point on Earth's surface and the equatorial plane. The equator is 0 degrees. The North Pole is +90 degrees. The South Pole is -90 degrees. Latitude lines (called parallels) run horizontally around the globe and stay the same distance apart everywhere.
One degree of latitude is always close to 111 kilometres on the ground, regardless of where you are. That stability is what makes latitude useful for everything from flight planning to climate science.
What Longitude Measures
Longitude is the angle between a point and the prime meridian, the line that passes through Greenwich, London, at 0 degrees longitude. Longitude runs from -180 degrees (west) to +180 degrees (east). The two values meet on the opposite side of the planet at the antimeridian, which forms most of the International Date Line.
Unlike latitude, the ground distance covered by one degree of longitude depends on where you are. At the equator, one degree of longitude is about 111 km, the same as latitude. At Helsinki it is about 56 km. At the poles it shrinks to zero, because all longitude lines converge there.
This convergence is why distance calculations on a flat map break for long routes or for points near the poles. Proper distance functions use the haversine formula or vincenty's formula, which account for the Earth's curvature.
The Famous Swap (and How to Avoid It)
The single most common mistake in production geospatial code is swapping latitude and longitude. The reason is that different formats have different conventions:
- Human display, addresses, GPS apps: latitude first.
48.8584, 2.2945means lat 48.8584, lng 2.2945. - GeoJSON, WKT, most geospatial standards: longitude first.
[2.2945, 48.8584]is the same point. - MapAtlas Geocoding API and most "v1" REST APIs: latitude first in JSON keys (
lat,lng), but check the endpoint docs because conventions vary.
If you are pulling a feature out of GeoJSON and dropping it into a map library that expects [lat, lng], you have to swap. If you forget, your point lands in the wrong hemisphere, and every map debugging session for the next two days will be confusion about why "Paris" is appearing somewhere off the coast of Africa.
A defensive rule: in any function that takes coordinates, name the parameters explicitly. function distance(latA, lngA, latB, lngB) is harder to misuse than function distance(a, b) where a and b are vague arrays.
Decimal Degrees vs DMS
The most common format you will see in code is decimal degrees (DD): 48.8584, 2.2945. This is what every modern API and library expects.
You will occasionally meet degrees-minutes-seconds (DMS): 48 deg 51' 30" N, 2 deg 17' 40" E. DMS comes from older maritime and aviation tradition, and it is still used on official paper maps and some hardware GPS units. Converting DMS to DD is straightforward: DD = degrees + (minutes / 60) + (seconds / 3600), with negation for South or West.
For storage, decimal degrees with 5 to 6 digits of precision covers every realistic use case. More than 6 places is precision theatre, since real-world GPS units rarely deliver better than centimetre accuracy.
How Many Digits of Precision Do You Need?
Each decimal place of latitude or longitude refines the position by roughly a factor of 10:
- 0 decimal places (
48): about 111 km, country level - 1 place (
48.8): about 11 km, city level - 2 places (
48.86): about 1.1 km, neighbourhood level - 3 places (
48.858): about 110 metres, street level - 4 places (
48.8584): about 11 metres, building level - 5 places (
48.85844): about 1 metre, doorway level - 6 places (
48.858445): about 11 centimetres, GPS limit - 7+ places: false precision, exceeds real-world GPS accuracy
Pick the precision that matches what you are doing. Storing 8 decimal places for a "deliver to this neighbourhood" use case wastes space and gives the user a misleading sense of how exact the data is.
Coordinates and Map Projections
The numbers themselves are angular measurements on the Earth's surface, but a screen is flat. Every map projection is a mathematical function that turns latitude and longitude into pixel x,y for display.
Web Mercator (EPSG:3857) is the projection used by Google Maps, OpenStreetMap, and almost every interactive web map. It preserves shape and direction but distorts area: Greenland looks the size of Africa, when in reality it is fourteen times smaller. For production maps, this distortion does not matter as long as users can recognise places. For thematic maps that compare areas (population, election results, climate), use an equal-area projection instead.
The coordinate values you store are always in WGS84 latitude and longitude. The projection is applied at render time. Mixing projection-space coordinates with WGS84 coordinates in your database is another classic source of bugs.
Storing and Indexing Coordinates
In most databases, store latitude and longitude as two numeric columns (or geometry(point, 4326) if you are using PostGIS). For point lookups within a bounding box, a B-tree index on each column is enough. For "nearest neighbour" queries, you want a spatial index: PostGIS GIST, MySQL SPATIAL, or a geohash bucket.
Storing as a string ("48.8584,2.2945") will haunt you the moment you need to filter, sort, or compute a distance. Don't do it.
How AI Assistants Use Coordinates
Modern AI assistants (ChatGPT, Perplexity, Gemini) reason about places through coordinates the same way human applications do. When a user asks "find a coffee shop near me", the assistant resolves the user's location to a coordinate, queries a places API, and ranks the results by haversine distance. Properly tagged coordinates in your structured data (JSON-LD geo property, GeoCoordinates schema) help AI assistants pick your listing over a competitor with vaguer location data.
For listings that span borders or compete in multiple cities, the coordinate is the disambiguator. "Paris" is ambiguous: there is one in France and one in Texas. The coordinate is not.
Why MapAtlas
MapAtlas is the European mapping platform built for the AI search era. Every geocode, reverse lookup, isochrone, and routing call returns clean WGS84 coordinates with consistent ordering, GDPR compliance, and EU hosting. Try the Coordinates Lookup tool to convert any address to lat/lng instantly, or read the What Is a Geocode guide for a deeper look at how geocoding APIs work in production.
Frequently Asked Questions
What is the difference between longitude and latitude?
Latitude measures the north-south position on Earth (between -90 at the South Pole and +90 at the North Pole), while longitude measures the east-west position (between -180 and +180, with 0 at the Greenwich meridian). Latitude lines run horizontally and are parallel to each other. Longitude lines run vertically and converge at the poles. Together they form a unique pair of numbers that pinpoints any location on the planet.
Which one comes first, longitude or latitude?
It depends on the format. In human-readable form (Google Maps, GPS apps, addresses), latitude is written first: 48.8584, 2.2945 means lat 48.8584, lng 2.2945. In machine-readable formats like GeoJSON and most geospatial standards, longitude comes first: [2.2945, 48.8584]. This swap is the single most common source of map bugs in production. Always check the convention of the specific format you are using.
How accurate are GPS coordinates?
Six decimal places of precision (e.g. 48.858444) is accurate to about 11 centimetres at the equator. Five places (48.85844) gives roughly 1 metre. Four places (48.8584) gives about 11 metres, which is fine for street-level mapping. For most production use cases, 6 places is overkill and 5 is plenty. Storing more precision than you need wastes bytes and creates a false sense of accuracy.
Why do longitude lines converge at the poles?
Latitude lines are parallel because they all share the Earth's axis as their reference. Longitude lines, by contrast, are great circles that all pass through the North and South Poles. As you move toward the poles, the east-west distance between two longitude values shrinks: at the equator, one degree of longitude is about 111 km, but at the poles it shrinks to zero. This is why naive distance calculations using flat coordinates break in high latitudes, and why proper distance calculations use the haversine formula or vincenty's formula.

