Conversion factors that transform coordinate data into integers
The database uses offset values and scale factors to convert the coordinate data that you provide to positive integers.
The default spatial reference systems already have offset value and scale factors associated with them. If you are creating a new spatial reference system, determine the scale factors and, optionally, the offset values that work best with your data.
Offsets
An offset value is a number that is subtracted from all coordinates, leaving only positive values as a remainder.
The database converts your coordinate data using the following formulas to ensure that all adjusted coordinate values are greater than 0.
minrepresents
the minimum of all. For example,
min(x)means
the minimum of all x coordinates. The offset for each geographic direction is represented as dimensionOffset. For example, xOffset is the offset value applied to all X coordinates.
min(x) - xOffset ≥ 0
min(y) - yOffset ≥ 0
min(z) - zOffset ≥ 0
min(m) - mOffset ≥ 0
Scale factors
A scale factor is a value 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.
The database converts your decimal coordinate data using the following formulas to ensure that all adjusted coordinate values are positive integers. The converted values cannot exceed 253 (approximately 9 * 1015).
In these formulas, the notation max
represents the maximum of all
. The offset for
each geographic dimension is represented as dimensionOffset (for
example, xOffset is the offset value applied to all X coordinates). The scale factor for each
geographic dimension is represented as dimensionScale (for
example, xScale is the scale factor applied to X coordinates).
(max(x) - xOffset) * xScale ≤ 253
(max(y) - yOffset) * yScale ≤ 253
(max(z) - zOffset) * zScale ≤ 253
(max(m) - mOffset) * mScale ≤ 253
- You use the same scale factor for X and Y coordinates.
- When multiplied by a decimal X coordinate or a decimal Y coordinate, the scale factor yields a value less than 253. One common technique is to make the scale factor a power of 10. That is, the scale factor should be 10 to the first power (10), 10 to the second power (100), 10 to the third power (1000), or, if necessary, a larger factor.
- The scale factor is large enough to ensure that the number of significant digits in the new integer is the same as the number of significant digits in the original decimal coordinate.
For example, suppose that the ST_Point function is specified input that consists of an X coordinate of 10.01, a Y coordinate of 20.03, and the identifier of a spatial reference system. When ST_Point is invoked, it multiplies the value of 10.01 and the value of 20.03 by the spatial reference system's scale factor for X and Y coordinates. If this scale factor is 10, the resulting integers that the database stores will be 100 and 200, respectively. Because the number of significant digits in these integers (3) is less than the number of significant digits in the coordinates (4), the database is not able to convert these integers back to the original coordinates, or to derive from them values that are consistent with the coordinate system to which these coordinates belong. But if the scale factor is 100, the resulting integers that the database stores are 1001 and 2003-values that can be converted back to the original coordinates or from which compatible coordinates can be derived.
Units for offset values and scale factors
Whether you use an existing spatial reference system or create a new one, the units for the offset values and scale factors will vary depending on the type of coordinate system that you are using.
For example, if you are using a geographic coordinate system, the values are in angular units such as decimal degrees; if you are using a projected coordinate system, the values are in linear units such as meters or feet.