OR REPLACE clause
Including the OR REPLACE creates a new spatial unit of measure, or replaces an existing spatial unit of measure with
the same name. This clause preserves existing privileges. An error is returned if you attempt to replace a spatial unit that
is already in use.
Defines whether the unit of measure is used for angles (ANGULAR) or distances (LINEAR).
The conversion factor for the spatial unit relative to the base unit. For linear units, the base unit is METRE. For angular
units, the base unit is RADIAN.
The CONVERT USING clause is used to define how to convert a measurement in the defined unit of measure to the base unit of
measure (radians or meters). The measurement is multiplied by the supplied conversion factor to get a value in the base unit
of measure. For example, a measurement of 512 millimeters would be multiplied by a conversion factor of 0.001 to get a measurement
of 0.512 metres.
Spatial reference systems always include a linear unit of measure to be used when calculating distances (ST_Distance or ST_Length),
or area. For example, if the linear unit of measure for a spatial reference system is miles, then the area unit used is square
miles. In some cases, spatial methods accept an optional parameter that specifies the linear unit of measure to use. For example,
if the linear unit of measure for a spatial reference system is in miles, you could retrieve the distance between two geometries
in meters by using the optional parameter 'metre'.
For projected coordinate systems, the X and Y coordinates are specified in the linear unit of the spatial reference system.
For geographic coordinate systems, the latitude and longitude are specified in the angular units of measure associated with
the spatial reference system. In many cases, this angular unit of measure is degrees but any valid angular unit of measure
can be used.
You can use the sa_install_feature system procedure to add predefined units of measure to your database.