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

Db2® Spatial Extender converts
your decimal coordinate data using the following formulas to ensure
that all adjusted coordinate values are positive integers. The converted
values cannot exceed 2^{53} (approximately 9 * 10^{15}).

**Formula notation: **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 ≤ 2
```^{53}
(max(y) - yOffset) * yScale ≤ 2^{53}
(max(z) - zOffset) * zScale ≤ 2^{53}
(max(m) - mOffset) * mScale ≤ 2^{53}

- 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 2
^{53}. 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.

## Example

Suppose that the ST_Point function is given 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 Spatial Extender 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), Spatial Extender 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 Spatial Extender stores are 1001 and 2003-values that can be converted back to the original coordinates or from which compatible coordinates can be derived.