ST_CREATE_SRS procedure

Use the ST_CREATE_SRS stored procedure to create a spatial reference system.

A spatial reference system is defined by the coordinate system, the precision, and the extents of coordinates that are represented in this spatial reference system. The extents are the minimum and maximum possible coordinate values for the X, Y, Z, and M coordinates.

Internally, the database stores the coordinate values as positive integers. Thus during computation, the impact of rounding errors (which are heavily dependent on the actual value for floating-point operations) can be reduced. Performance of the spatial operations can also improve significantly.

This stored procedure has two variations:
  • The first variation takes the conversion factors (offsets and scale factors) as input parameters.
  • The second variation takes the conversion factors as well as a customized coordinate system definition.

Authorization

The user ID under which the stored procedure is invoked must have SYSGEOADM authority.

Syntax

With conversion factors (version 1)
Read syntax diagramSkip visual syntax diagram SYSGEO.ST_CREATE_SRS ST_CREATE_SRS ( srs_name,srs_id,x_offsetnull,y_offsetnull,xy_scale,z_offsetnull,z_scalenull,m_offsetnull,m_scalenull,coordsys_name,descriptionnull)
With conversion factors and customized coordinate system (version 2)
Read syntax diagramSkip visual syntax diagram SYSGEO.ST_CREATE_SRS ST_CREATE_SRS ( srs_name , srs_id , x_offsetnull , y_offsetnull , xy_scale , z_offsetnull , z_scalenull , m_offsetnull , m_scalenull , coordsys_name , organizationnull , organization_coordsys_idnull definition descriptionnull )

Parameter descriptions

srs_name
Identifies the spatial reference system. You must specify a non-null value for this parameter.

The data type of this parameter is VARCHAR(128).

srs_id
Uniquely identifies the spatial reference system. This numeric identifier is used as an input parameter for various spatial functions. You must specify a non-null value for this parameter.

The data type of this parameter is INTEGER.

x_offset
Specifies the offset for all X coordinates of geometries that are represented in this spatial reference system. The offset is subtracted before the scale factor x_scale is applied when geometries are converted from external formats (WKT, WKB, shape, etc.) to an internal format. Although you must specify a value for this parameter, the value can be null. If this parameter is null, a value of 0 (zero) is used.

The data type of this parameter is DOUBLE.

y_offset
Specifies the offset for all Y coordinates of geometries that are represented in this spatial reference system. The offset is subtracted before the scale factor y_scale is applied when geometries are converted from external formats (WKT, WKB, shape, etc.) to an internal format. Although you must specify a value for this parameter, the value can be null. If this parameter is the null value, a value of 0 (zero) is used.

The data type of this parameter is DOUBLE.

xy_scale
Specifies the scale factor for all X and Y coordinates of geometries that are represented in this spatial reference system. The scale factor is applied (multiplication) after the offset is subtracted when geometries are converted from external formats (WKT, WKB, shape, etc.) to an internal format.

The data type of this parameter is DOUBLE.

z_offset
Specifies the offset for all Z coordinates of geometries that are represented in this spatial reference system. The offset is subtracted before the scale factor z_scale is applied when geometries are converted from external formats (WKT, WKB, shape, etc.) to an internal format. Although you must specify a value for this parameter, the value can be null. If this parameter is null, a value of 0 (zero) is used.

The data type of this parameter is DOUBLE.

z_scale
Specifies the scale factor for all Z coordinates of geometries that are represented in this spatial reference system. The scale factor is applied (multiplication) after the offset z_offset is subtracted when geometries are converted from external formats (WKT, WKB, shape, etc.) to an internal format. Either the z_offset value is specified explicitly, or a default z_offset value of 0 is used. Although you must specify a value for this parameter, the value can be null. If this parameter is null, a value of 1 is used.

The data type of this parameter is DOUBLE.

m_offset
Specifies the offset for all M coordinates of geometries that are represented in this spatial reference system. The offset is subtracted before the scale factor m_scale is applied when geometries are converted from external formats (WKT, WKB, shape, etc.) to an internal format. Although you must specify a value for this parameter, the value can be null. If this parameter is null, a value of 0 (zero) is used.

The data type of this parameter is DOUBLE.

m_scale
Specifies the scale factor for all M coordinates of geometries that are represented in this spatial reference system. The scale factor is applied (multiplication) after the offset m_offset is subtracted when geometries are converted from external formats (WKT, WKB, shape, etc.) to an internal format. Either the m_offset value is specified explicitly, or a default m_offset value of 0 is used. Although you must specify a value for this parameter, the value can be null. If this parameter is null, a value of 1 is used.

The data type of this parameter is DOUBLE.

coordsys_name
Uniquely identifies the coordinate system on which this spatial reference system is based. The coordinate system must be listed in the view SYSGEO.ST_COORDINATE_SYSTEMS. You must supply a non-null value for this parameter.

The coordsys_name value is converted to uppercase unless you enclose it in double quotation marks.

The data type of this parameter is VARCHAR(128).

description
Describes the spatial reference system by explaining the application's purpose. Although you must specify a value for this parameter, the value can be null. If this parameter is null, no description information is recorded.

The data type of this parameter is VARCHAR(256).

organization
Names the organization that defined the coordinate system and provided the definition for it; for example, "European Petroleum Survey Group (EPSG)." Although you must specify a value for this parameter, the value can be null.

If this parameter is null, the organization_coordsys_id parameter must also be null. If this parameter is not null, the organization_coordsys_id parameter cannot be null; in this case, the combination of the organization and organization_coordsys_id parameters uniquely identifies the coordinate system.

The data type of this parameter is VARCHAR(128).

organization_coordsys_id
Specifies a numeric identifier. The entity that is specified in the organization parameter assigns this value. This value is not necessarily unique across all coordinate systems. Although you must specify a value for this parameter, the value can be null.

If this parameter is null, the organization parameter must also be null. If this parameter is not null, the organization parameter cannot be null; in this case, the combination of the organization and organization_coordsys_id parameters uniquely identifies the coordinate system.

The data type of this parameter is INTEGER.

definition
Defines the coordinate system. You must specify a non-null value for this parameter. The vendor that supplies the coordinate system usually provides the information for this parameter.

The data type of this parameter is VARCHAR(2048).

description
Describes the spatial reference system by explaining the application's purpose. Although you must specify a value for this parameter, the value can be null. If this parameter is null, no description information is recorded.

The data type of this parameter is VARCHAR(256).

Example

This example uses a Db2® CALL command to create a spatial reference system named SRSDEMO with the following parameter values:
  • srs_id: 99
  • x_offset: -180
  • y_offset: -90
  • xy_scale: 1000000

call ST_CREATE_SRS('SRSDEMO', 99, -180, -90, 1000000, 0, 1, 0, 1, 'GCS_WGS_1984', 'SRS for river table')