Creating a spatial reference system
Create a new spatial reference system if none of the spatial reference systems that are provided with Db2® Spatial Extender work with your data.
Procedure
To create a spatial reference system:
- Choose a spatial reference system ID (SRID) that is not already in use.
- Decide on the degree of precision for
the spatial reference system by using one of the following methods:
- Indicating the extents of the geographical area that you are working with and the scale factors that you want to use with your coordinate data. Spatial Extender calculates the offset values.
- Indicating both the offset values (required for Spatial Extender to convert negative values to positive values) and scale factors (required for Spatial Extender to convert decimal values to integers). Use this method when you must follow strict criteria for accuracy or precision.
- Calculate the conversion information that Spatial Extender
requires to convert coordinate data to positive integers. The information
to calculate varies depending on the method that you chose in 2.
- For the extents method, 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, set the scale factor 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.
- For the offset method, calculate the following information:
- 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 what scale factors to use and enter these scale factors in the Create Spatial Reference System window.
- For the extents method, calculate the following information:
-
Issue the db2se create_srs command or call the
DB2SE.ST_CREATE_SRS procedure to create the spatial reference system.Call the DB2SE.ST_CREATE_SRS procedure to create the spatial reference system.
The following example shows how to create a spatial reference system called mysrs:
db2se create_srs mydb -srsName mysrs -srsID 100 -xScale 10 -coordsysName GCS_North_American_1983
call DB2GSE.ST_CREATE_SRS('mysrs',100, -180,1000000, -90, 1000000, 0, 1, 0, 1,'NORTH_AMERICAN', 'SRS for GSE Demo Program: customer table',?,?)