2

MySQL supports using ST_PointFromText to construct a point with an SRID,

  • ST_PointFromText(wkt[, srid [, options]])

    Constructs a Point value using its WKT representation and SRID.

This assumes the input is Well-Known Text (WKT). How do I construct a point with latitude and longitude as doubles (or floating point types).

5

MySQL 8.0+

MySQL supports Point(x,y) which is a GIS function that constructs a point. With MySQL 8.0 and newer, you can further assign an SRID to that point with ST_SRID(srid)

SELECT ST_SRID( Point(0,0), 4326);

This is a relatively new feature implemented in MySQL 8.0 with #WL8543. MariaDB does not support it.

In PostGIS, you would use,

SELECT ST_SetSRID( ST_MakePoint(0,0), 4326);

In MariaDB, your only option is,

ST_PointFromText(wkt[, srid [, options]])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.