Geospatial software has a fundamental inconsistency: which order we put longitude and latitude in. Below, a table of each format and technology's decision, and below that, some explanations.
lon, lat | lat, lon |
---|---|
formats | formats |
javascript apis | javascript apis |
mobile apis | mobile apis |
|
|
service specifications | service specifications |
misc | misc |
|
A frustrating inconsistency in geospatial (mapping) software is coordinate order. Coordinates are often represented as arrays, like [-87.73, 41.83]
, instead of objects, like { lng: -87.73, lat: 41.83 }
. This leaves it up to the developer to determine whether -87.73 is the longitude or latitude. One choice places a point on Chicago, and the other a location deep in Antarctica.
There's some consensus growing around longitude, latitude order for geospatial formats, but still chaos for libraries and software. It's up to the developer to be aware of this issue and read the requisite documentation, and flip coordinates if necessary to translate between different systems.
long
is a number type in the C and C++ languages, and likely others. So if you were to write float long;
to define a floating-point longitude value, it'll result in a syntax error. So I always use lon
, which is not a keyword or built-in type in any language I've encountered.