MySQL tutorial: ST_SRID [EN]
top of page
CerebroSQL

MySQL: 

ST_SRID

ST_SRID(g[, srid])

With a single argument representing a valid geometry object g,
ST_SRID() returns an integer indicating the ID of the spatial reference
system (SRS) associated with g.

With the optional second argument representing a valid SRID value,
ST_SRID() returns an object with the same type as its first argument
with an SRID value equal to the second argument. This only sets the
SRID value of the object; it does not perform any transformation of
coordinate values.

ST_SRID() handles its arguments as described in the introduction to
this section, with this exception:

o For the single-argument syntax, ST_SRID() returns the geometry SRID
even if it refers to an undefined SRS. An ER_SRS_NOT_FOUND
(https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference
.html#error_er_srs_not_found) error does not occur.

ST_SRID(g, target_srid) and ST_Transform(g, target_srid) differ as
follows:

o ST_SRID() changes the geometry SRID value without transforming its
coordinates.

o ST_Transform() transforms the geometry coordinates in addition to
changing its SRID value.

URL: https://dev.mysql.com/doc/refman/8.0/en/gis-general-property-functions.html

Example

mysql> SET @g = ST_GeomFromText('LineString(1 1,2 2)', 0);
mysql> SELECT ST_SRID(@g);
+-------------+
| ST_SRID(@g) |
+-------------+
| 0 |
+-------------+
mysql> SET @g = ST_SRID(@g, 4326);
mysql> SELECT ST_SRID(@g);
+-------------+
| ST_SRID(@g) |
+-------------+
| 4326 |
+-------------+

bottom of page