Creating a spatial reference system

Create a new spatial reference system if none of the predefined spatial reference systems work with your data.

Procedure

To create a spatial reference system:

  1. Choose a spatial reference system ID (SRID) that is not already in use.
  2. Determine the degree of precision for the spatial reference system to calculate the offset values (required to convert negative values to positive values) and scale factors (required to convert decimal values to integers).
  3. Calculate the offset values and scale factors:
    Offset values
    If your coordinate data includes negative numbers or measures, 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 the multiplier needed to convert the coordinates into an integer. If coordinates still include decimals after scaling, spatial functions may fail, for example, because polygon boundaries do not align.
  4. Call the ST_CREATE_SRS procedure to create the spatial reference system.
    The following example shows how to create a spatial reference system called mysrs using one of the predefined coordinate system definitions:
    call ST_CREATE_SRS('mysrs',100, -180, -90, 1000000,
                         0, 1, 0, 1,'NORTH_AMERICAN', 'SRS sample')