Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

CREATE SPATIAL UNIT OF MEASURE statement

Creates or replaces a spatial unit of measurement.

Syntax
CREATE [ OR REPLACE ] SPATIAL UNIT OF MEASURE identifier 
TYPE {LINEAR | ANGULAR }
[ CONVERT USING number ][ IF NOT EXISTS ] 
Parameters
  • 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.

    You cannot specify the IF NOT EXISTS clause if you specify this clause.

  • TYPE clause

    Defines whether the unit of measure is used for angles (ANGULAR) or distances (LINEAR).

  • CONVERT USING

    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.

  • IF NOT EXISTS

    Creates the spatial unit of measure if it does not exist and does not return any message. You cannot specify this clause if you specify the OR REPLACE clause.

Remarks

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.

Privileges

You must have the MANAGE ANY SPATIAL OBJECT or CREATE ANY OBJECT system privilege.

Side effects

None

Standards
  • ANSI/ISO SQL Standard

    Not in the standard.

Example

The following example creates a spatial unit of measure named Test.

CREATE SPATIAL UNIT OF MEASURE Test
TYPE LINEAR
CONVERT USING 15;