Топ-100
 

CREATE SPATIAL REFERENCE SYSTEM

База данных: MySQL
Текст

Syntax:
CREATE OR REPLACE SPATIAL REFERENCE SYSTEM
srid srs_attribute ...

CREATE SPATIAL REFERENCE SYSTEM
[IF NOT EXISTS]
srid srs_attribute ...

srs_attribute: {
NAME 'srs_name'
| DEFINITION 'definition'
| ORGANIZATION 'org_name' IDENTIFIED BY org_id
| DESCRIPTION 'description'
}

srid, org_id: 32-bit unsigned integer

This statement creates a spatial reference system (SRS) definition and
stores it in the data dictionary. It requires the SUPER privilege. The
resulting data dictionary entry can be inspected using the
INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS table.

SRID values must be unique, so if neither OR REPLACE nor IF NOT EXISTS
is specified, an error occurs if an SRS definition with the given srid
value already exists.

With CREATE OR REPLACE syntax, any existing SRS definition with the
same SRID value is replaced, unless the SRID value is used by some
column in an existing table. In that case, an error occurs. For
example:

mysql> CREATE OR REPLACE SPATIAL REFERENCE SYSTEM 4326 ...;
ERROR 3716 (SR005): Can't modify SRID 4326. There is at
least one column depending on it.

To identify which column or columns use the SRID, use this query,
replacing 4326 with the SRID of the definition you are trying to
create:

SELECT * FROM INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS WHERE SRS_ID=4326;

With CREATE ... IF NOT EXISTS syntax, any existing SRS definition with
the same SRID value causes the new definition to be ignored and a
warning occurs.

URL: https://dev.mysql.com/doc/refman/8.0/en/create-spatial-reference-system.html

Пример

CREATE SPATIAL REFERENCE SYSTEM 4120
NAME 'Greek'
ORGANIZATION 'EPSG' IDENTIFIED BY 4120
DEFINITION
'GEOGCS["Greek",DATUM["Greek",SPHEROID["Bessel 1841",
6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],
AUTHORITY["EPSG","6120"]],PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,
AUTHORITY["EPSG","9122"]],AXIS["Lat",NORTH],AXIS["Lon",EAST],
AUTHORITY["EPSG","4120"]]';