

© 2025 by The Clinic. Powered and secured by Wix
MySQL:
ST_ASGEOJSON
ST_AsGeoJSON(g [, max_dec_digits [, options]])
Generates a GeoJSON object from the geometry g. The object string has
the connection character set and collation.
If any argument is NULL, the return value is NULL. If any non-NULL
argument is invalid, an error occurs.
URL: https://dev.mysql.com/doc/refman/8.0/en/spatial-geojson-functions.html
Example
mysql> SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(11.11111 12.22222)'),2);
+-------------------------------------------------------------+
| ST_AsGeoJSON(ST_GeomFromText('POINT(11.11111 12.22222)'),2) |
+-------------------------------------------------------------+
| {"type": "Point", "coordinates": [11.11, 12.22]} |
+-------------------------------------------------------------+