ST_create_srs_2

Use this stored procedure to create a spatial reference system. The ST_create_srs_2 stored procedure takes the extents and the precision as input parameters and calculates the conversion factors internally.

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.

This stored procedure has two variations. This variation takes the extents and the precision as input parameters and calculates the conversion factors internally. The other variation, the ST_create_srs stored procedure, takes the conversion factors (offsets and scale factors) as input parameters.

Authorization

The user ID under which the stored procedure is invoked must have the following authorities or privileges:
  • SYSADM or DBADM authority
  • INSERT and SELECT privileges on the catalog table or view

Syntax

Read syntax diagramSkip visual syntax diagramsysproc.ST_create_srs_2(srs_name,srs_id,x_min,x_max,x_scale,,y_min,y_maxy_scalenull,z_min,z_max,z_scalenull,m_min,m_max,m_scalenull,coordsys_name,descriptionnull,msg_code,msg_text)

Parameter descriptions

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

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

The data type of this parameter is VARCHAR(128) or, if you enclose the value in double quotation marks, VARCHAR(130).

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_min
Specifies the minimum possible X coordinate value for all geometries that use this spatial reference system. You must specify a non-null value for this parameter.

The data type of this parameter is DOUBLE.

x_max
Specifies the maximum possible X coordinate value for all geometries that use this spatial reference system. You must specify a non-null value for this parameter.

Depending on the value of x_scale, the value that is shown in the view DB2GSE.ST_SPATIAL_REFERENCE_SYSTEMS might be larger than the value that is specified here. The value from the view is correct.

The data type of this parameter is DOUBLE.

x_scale
Specifies the scale factor for all X coordinates of geometries that are represented in this spatial reference system. The scale factor is applied (multiplication) after the offset x_offset is subtracted when geometries are converted from external representations (WKT, WKB, shape) to the IBM® Spatial Support for Db2 for z/OS® internal representation. The calculation of the offset x_offset is based on the x_min value. You must supply a non-null value for this parameter.

If both the x_scale and y_scale parameters are specified, the values must match.

The data type of this parameter is DOUBLE.

y_min
Specifies the minimum possible Y coordinate value for all geometries that use this spatial reference system. You must supply a non-null value for this parameter.

The data type of this parameter is DOUBLE.

y_max
Specifies the maximum possible Y coordinate value for all geometries that use this spatial reference system. You must supply a non-null value for this parameter.

Depending on the value of y_scale, the value that is shown in the view DB2GSE.ST_SPATIAL_REFERENCE_SYSTEMS might be larger than the value that is specified here. The value from the view is correct.

The data type of this parameter is DOUBLE.

y_scale
Specifies the scale factor for all Y coordinates of geometries that are represented in this spatial reference system. The scale factor is applied (multiplication) after the offset y_offset is subtracted when geometries are converted from external representations (WKT, WKB, shape) to the IBM Spatial Support for Db2 for z/OS internal representation. The calculation of the offset y_offset is based on the y_min value. Although you must specify a value for this parameter, the value can be null. If this parameter is null, the value of the x_scale parameter is used. If both the y_scale and x_scale parameters are specified, the values must match.

The data type of this parameter is DOUBLE.

z_min
Specifies the minimum possible Z coordinate value for all geometries that use this spatial reference system. You must specify a non-null value for this parameter.

The data type of this parameter is DOUBLE.

z_max
Specifies the maximum possible Z coordinate value for all geometries that use this spatial reference system. You must specify a non-null value for this parameter.

Depending on the value of z_scale, the value that is shown in the view DB2GSE.ST_SPATIAL_REFERENCE_SYSTEMS might be larger than the value that is specified here. The value from the view is correct.

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 representations (WKT, WKB, shape) to the IBM Spatial Support for Db2 for z/OS internal representation. The calculation of the offset z_offset is based on the z_min value. 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_min
Specifies the minimum possible M coordinate value for all geometries that use this spatial reference system. You must specify a non-null value for this parameter.

The data type of this parameter is DOUBLE.

m_max
Specifies the maximum possible M coordinate value for all geometries that use this spatial reference system. You must specify a non-null value for this parameter.

Depending on the value of m_scale, the value that is shown in the view DB2GSE.ST_SPATIAL_REFERENCE_SYSTEMS might be larger than the value that is specified here. The value from the view is correct.

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 representations (WKT, WKB, shape) to the IBM Spatial Support for Db2 for z/OS internal representation. The calculation of the offset m_offset is based on the m_min value. 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 ST_COORDINATE_SYSTEMS. You must specify a non-null value for this parameter.

Specify the coordsys_name value in uppercase letters.

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

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).

Output parameters

msg_code
Specifies the message code that is returned from the stored procedure. The value of this output parameter identifies the error, success, or warning condition that was encountered during the processing of the procedure. If this parameter value is for a success or warning condition, the procedure finished its task. If the parameter value is for an error condition, no changes to the database were performed.

The data type of this output parameter is INTEGER.

msg_text
Specifies the actual message text, associated with the message code, that is returned from the stored procedure. The message text can include additional information about the success, warning, or error condition, such as where an error was encountered.

The data type of this output parameter is VARCHAR(4096).

When the message code that is returned is 0 (zero), the message text parameter is set to null.

Example

This example shows how to use a Db2 CALL statement to invoke the ST_create_srs_2 stored procedure. This example uses a Db2 CALL statement to create a spatial reference system named SRSDEMO with the following parameter values:
  • srs_id: 1000000
  • x_offset: -180
  • x_scale: 1000000
  • y_offset: -90
  • y_scale: 1000000
call sysproc.ST_create_srs_2('SRSDEMO',1000000, -180,1000000, -90, 1000000, 
0, 1, 0, 1,'NORTH_AMERICAN', 'SRS for GSE Demo Program: customer table',?,?) 

The two question marks at the end of this CALL statement represent the output parameters, msg_code and msg_text. The values for these output parameters are returned after the stored procedure is called.