# Latitude and Longitude are Not Enough

A given latitude and longitude location would always mean the same thing only if the Earth was a perfectly round, unchanging sphere, which it is not.  Instead, the Earth is an irregular, lumpy ellipsoid with a shape that changes over time due to geologic action.  The irregular shape of the Earth usually can be approximated fairly well to map a particular region of interest by assuming the surface in that region is part of a smooth ellipsoid which is positioned at some offset from whatever is considered to be the center of the Earth.   See the Earth as an Ellipsoid topic.

The exact values of latitude and longitude that specify a particular location on Earth depend on which size, shape and placement of ellipsoid we use to represent the surface of the Earth in the region of interest. The exact, same location on Earth can have different latitude and longitude numbers depending on which ellipsoid is being used and how that ellipsoid is used.  Conversely, the exact location specified by a given pair of latitude and longitude coordinates, such as a longitude of -96.65435872972012 and a latitude of 33.12971033155918, depends on what ellipsoid is being used and how.

We can plot the latitude and longitude location of the In-N-Out restaurant in Allen, Texas, in two different layers using two different ellipsoids for the layers, one layer showing a green icon for the position and the other layer using a blue icon for the layer.   In both cases the longitude and latitude numbers are identical but the ellipsoids are different with the name of the ellipsoid used being shown beneath the latitude and longitude numbers.

The WGS84 ellipsoid is a good match to the "automatic" WGS84 ellipsoid used by most web mapping servers, so the position it shows for the geocoded longitude and latitude of the restaurant is a reasonably close match to the position shown in the Open Street Maps base map layer.    Slight mismatches like that are typical when plotting geocoded addresses because the geocoding software used to determine the latitude and longitude of a given address might not match exactly precise maps of features on the ground that are created based on satellite or aerial photos.    As anybody knows who has searched for a street address using a car's GPS navigator, the positions shown for addresses are usually just approximations.

The blue location icon using the Everest 1830 (India) ellipsoid shows the identically same latitude and longitude numbers when plotted on the Everest 1830 (India) ellipsoid.   The coordinate pair using that ellipsoid appears in a very different position, about 200 meters / yards away from the green icon, because the Everest 1830 (India) ellipsoid is shaped and positioned not to be a good match to the Earth's surface in Texas but instead to be a good match to what the Earth's surface in the Indian Himalayas was thought to be in 1830.

We chose that ellipsoid because while in 1830 it was considered a good match to the surface of the Earth in the vicinity of Mount Everest when measured from India, the surface of that ellipsoid does not particularly well align with the surface of the Earth in the vicinity of the In-N-Out burger restaurant in Allen, Texas.  So it shows the same lat/lon numbers in a visibly different location.

To understand what we see in the illustration above, and to understand how two different dots in what appears to be the same map can have exactly the same coordinates down to the 14th decimal point, we should first understand that what we see in the illustration above is a sandwich of three layers that consist of three different maps in three different coordinate systems.     We are looking through three semi-transparent surfaces of ellipsoids displayed together, and the ellipsoids do not quite line up.   So exactly the same coordinates on those three not-quite-lined-up ellipsoids do not line up either when we see them visually stacked together.

One surface is the base map at the bottom with roads and parking lot.   The second surface is transparent but for the green dot on it and the third surface is also transparent but for the blue dot on it.    If the second and third surfaces had grids drawn on them the green dot and the blue dot would both be graphed at the same numbers on those grids.   Think of the second and third surfaces as transparent layers of graph paper that are slightly displaced from each other.   Because the second and third surfaces are displaced from each other a bit, when we look at the two surfaces together we see dots plotted at exactly the same grid locations on each sheet but since the sheets are displaced the dots are slightly apart from each other.

Another way to think of this is to imagine the green dot drawn on a transparent balloon and the blue dot is also drawn on a transparent balloon, with both dots drawn at exactly the same latitude and longitude locations in their respective balloons.   If we put one balloon inside the other and then move it just a bit relative to the other balloon the two dots will not quite line up, because the balloon surfaces on which they are drawn will be slightly offset.  Each dot will be at exactly the same latitude and longitude location on its respective balloon, but because the balloon surfaces are offset if we look down through the transparent balloons the two dots will not quite line up.

In this case the "green dot balloon" surface is the ellipsoidal surface that has been sized and positioned so it is a better fit to the actual surface of the Earth in the vicinity of Texas.   The "blue dot balloon" ellipsoidal surface has been sized and positioned so it is a better fit to the actual surface of the Earth in the vicinity of Mount Everest, on the other side of the planet.  Therefore, exactly the same latitude and longitude coordinates marked on the "blue balloon" surface on the Texas side of the planet do not line up exactly with points marked on the "green balloon" surface that has been positioned so it is more flush with the actual surface of the planet in Texas.

Both sets of numbers are precisely alike in that they both mark exactly the same latitude and longitude on their respective "balloon" surfaces.   But because the "blue balloon" surface using the Everest ellipsoid has been nudged a bit toward Mount Everest so it aligns better there, the exact same relative spot on it as on the "green balloon" appears about 200 meters / yards away from the same spot marked on the "green balloon."   The "green balloon" surface is better aligned to the surface in Texas so it is a closer match to other maps, like the Open Street Maps base layer, used in Texas.

Note that neither the green dot nor the blue dot fall exactly on the location of the In-N-Out restaurant in Allen, Texas, as shown in the Open Street Maps layer.    The green dot is closer but still does not exactly align with the OSM layer.   That usually occurs when geocoding software, which is software that attempts to assign a latitude, longitude location to a given street address, estimates the position of a given street address using rules of thumb like approximate spacing of addresses along a street.    When the rules of thumb do not match the exact location of addresses the locations given by the geocoder for addresses will be slightly off.

The latitude and longitude locations for In-N-Out restaurants used in this documentation were obtained by running the street addresses of all In-N-Out restaurants through an on-line geocoder to generate an estimated geographic location for each address.  The idea that each address can be known to 14 decimal points of latitude or longitude degrees is absurd, but that is what the geocoder spits out as an estimate.  The green dot is the closest match to the OSM layer because they both use the same ellipsoid, the WGS84 ellipsoid, but they are slightly off because the geocoder estimated the location of the restaurant address along East Stacy Road at a slightly different location than it is in real life.

The moral of all the above?  Latitude and longitude numbers have meaning only within the context of a specific Earth ellipsoid.  Specifying only latitude and longitude numbers by themselves is not enough.  We must also specify which Earth ellipsoid, that is, which datum, was used to measure those numbers.

Given the popularity of the WGS84 ellipsoid as a default in many GPS devices, telephones and other consumer gadgets we could do worse than to assume that lat/lon numbers we encounter with no accompanying ellipsoid were measured using WGS84.  But if accuracy is important we should make the effort to find out for certain which ellipsoid was used.