How do you create a Geographic Point with MariaDB and MySQL? PostGIS provides a simple cast to construct a geography type from floating point lat, and long

SELECT ST_Point(1,2)::geography;     -- standard version (MM) less precision
SELECT ST_MakePoint(1,2)::geography; -- PostGIS version makes 2d, 3dz, 4d


However, despite the docs in MySQL clearly telling there is a difference between Cartesian and geodetic points, I can't find out how to construct a geography cord in MySQL or MariaDB?
MySQL

In MySQL 8+, the point is constructed the same way and whether or not it's geographic (geodetic) or geometric (carestian) is a function of the SRID and the POINT has the same type. So you'll want to use,

SELECT ST_SRID(Point(1,2), 4326);


You can set the SRID with ST_SRID

MariaDB

With MariaDB you're SOL. MariaDB still lacks the form that takes a second argument to set the SRID.

See also


How do I create a point with an SRID in MySQL?