Member-only story
Lat Lon or Lon Lat
Which coordinate order is correct?!
If you are a data scientist or developer new to dealing with geospatial data, this can be both confusing and an easy source of error.
Geographic coordinates are commonly presented as Latitude, Longitude e.g. in the World Geodetic System WGS 84 Standard as well as in popular culture, for example at the top of every wikipedia.org page about a geographic location.
In Mathematics however, the conventional order for Cartesian coordinates is horizontal or X coordinate, followed by the vertical axis or Y coordinate which would correspond to Longitude (X) followed by Latitude (Y).
One thing that quickly becomes clear when dealing with geospatial data is that there is no fixed standard on coordinate order.
In many web mapping APIs such as Google Maps, spatial coordinates are often returned in order of latitude then longitude. In spatial databases like PostGIS or modern data warehouses such as BigQuery, Snowflake or Redshift, spatial coordinates are in longitude followed by latitude.
There are even conflicting International Standards on the subject. ISO 19125: Geographic Information Simple Feature Access specifies Lon / Lat whereas ISO 6709: Standard representation of geographic point location by coordinates specifies the opposite — Lat / Lon.
The most common theory as to why latitude has traditionally been quoted first is that it was the first to be calculated. To calculate latitude you only need the sun or the North Star (Polaris). It wasn’t until much later in the 17th Century that clocks became accurate enough to calculate longitude. As the earth spins 360 degrees every day or 15 degrees every hour, if you set a clock in London, then set sail, by comparing the time on the clock, to noon (when the sun is highest wherever you are), you can calculate how many degrees east or west you have travelled.
Many computer applications using geospatial data however utilise lon, lat to conform with the traditional order of X, Y cartesian coordinates.
Ultimately it is down to the developer to check documentation very carefully as to the correct coordinate order for each application, otherwise you may find your coordinates plotting a long way away from where you expected…!
Tom Macwright has compiled a useful list of different technologies and which coordinate order they use: https://macwright.com/lonlat/