I built a wep app storing GPS coordinates, as SRID 4326. Coordinates are stored as Lon/Lat, and that was working fine on MySQL 5.6 and MySQL 5.7.
Since I upgraded to MySQL 8, I get the following error when trying to construct such a geometry:
SELECT ST_GeomFromText('POINT(-118 0)', 4326);
Latitude -118.000000 is out of range in function st_geomfromtext. It must be within [-90.000000, 90.000000].
I checked the MySQL documentation on SRS, which shows this entry for SRID 4326:
DEFINITION: ...
AXIS["Lat",NORTH],AXIS["Long",EAST]
Confirming that they assume it's Lat/Lon.
I've always seen SRID 4326 referenced as Lon/Lat before:
- spatialreference.org shows longitude first in bounds
- this answer on gis.stackexchange says "The coordinates in (EPSG) 4326 are long/lat", this post on postgis.net says the same
- ... and many more answers here and there on StackExchange and other sites
However, I just discovered the epsg.io site, that may be the canonical reference on the subject (?) that states that latitude comes first:
Axes: latitude, longitude.
So, which one should I trust? Is it Lat/Lon or Lon/Lat?