Creating a spatial reference system

Create a new spatial reference system if none of the spatial reference systems that are provided with IBM® Spatial Support for Db2 for z/OS® work with your data.

About this task

You use the SYSPROC.ST_create_srs stored procedure to create a spatial reference system. This stored procedure has two variations. The first variation, the SYSPROC.ST_create_srs stored procedure, takes the conversion factors (offsets and scale factors) as input parameters. The second variation, the ST_create_srs_2 stored procedure, takes the extents and the precision as input parameters and calculates the conversion factors internally. For more information, see ST_create_srs and ST_create_srs_2.

Procedure

To create a spatial reference system by using the SYSPROC.ST_create_srs stored procedure:

  1. Specify an appropriate spatial reference system ID (SRID).
    For spatial data in a flat-earth representation, specify an SRID that is not already defined.
  2. Decide on the degree of precision that you want.
    You can either:
    • Specify the extents of the geographical area that you are working with and the scale factors that you want to use with your coordinate data. IBM Spatial Support for Db2 for z/OS takes the extents that you specify and calculates the offset for you. To specify the extents, provide the appropriate parameters for the SYSPROC.ST_create_srs2 stored procedure.
    • Specify both the offset values (required for IBM Spatial Support for Db2 for z/OS to convert negative values to positive values) and scale factors (required for IBM Spatial Support for Db2 for z/OS to convert decimal values to integers). Use this method when you need to follow strict criteria for accuracy or precision. To specify the offset values and scale factors, provide the appropriate parameters for the SYSPROC.ST_create_srs stored procedure.
  3. Calculate the conversion information that IBM Spatial Support for Db2 for z/OS needs to convert coordinate data to positive integers, and provide this information to the interface that you chose.
    This information differs according to the method that you chose in the previous step.
    • If you chose to specify the extents, you need to calculate the following information:
      • Scale factors. If any of the coordinates that you are working with are decimal values, calculate scale factors. Scale factors are numbers that, when multiplied by decimal coordinates and measures, yields integers with at least the same number of significant digits as the original coordinates and measures. If the coordinates are integers, the scale factors can be set to 1. If the coordinates are decimal values, the scale factor should be set to a number that converts the decimal portion to an integer value. For example, if the coordinate units are meters and the accuracy of the data is 1 cm, you would need a scale factor of 100.
      • Minimum and maximum values for your coordinates and measures.
    • If you chose to specify the offset values and scale factors, you need to calculate the following information:
      • Offset values

        If your coordinate data includes negative numbers or measures, you need to specify the offset values that you want to use. An offset is a number that is subtracted from all coordinates, leaving only positive values as a remainder. If you are working with positive coordinates, set all offset values to 0. If you are not working with positive coordinates, select an offset that, when applied against the coordinate data, results in integers that are less than the largest positive integer value (9,007,199,254,740,992).

      • Scale factors

        If any of the coordinates for the locations that you are representing are decimal numbers, determine what scale factors to use.

  4. Run an application that invokes the SYSPROC.ST_create_srs stored procedure to create the spatial reference system.