Spatial Functions

Describes functions provided by Tibero Spatial.

Some Spatial functions are provided by default, and other Spatial functions are provided only in a specific environment (C++11 or later, Linux, x86, 64-bit). Some default Spatial functions perform calculations taking into account a coordinate system by using given SRID as an argument.

In the following, functions provided only in a specific environment are marked with (#), and functions that perform calculations taking into account a coordinate system are marked with ($).

ST_AGGR_ASTWKB(#)

Returns a GEOMETRY object as in the Tiny Well Known Binary (TWKB) format. TWKB of a set with an identifier is returned for each GEOMETRY object.

  • Syntax

[Figure 1] ST_AGGR_ASTWKB

[Figure 1] ST_AGGR_ASTWKB

  • Components

Component
Description

geom_expr

Expression indicating a GEOMETRY object.

num_expr

Identifier for each geom_expr.

num1

Number of significant digits after the decimal point of coordinates to be expressed as TWKB. (Default value: 0)

num2

Determines whether to include the length of the encoded GEOMETRY object in TWKB to return. The length is not included by default. If set to 1, it is included.

num3

Determines whether to include the bounding box of the GEOMETRY object in TWKB to return. The bounding box is not included by default. If set to 1, it is included.

  • Example


ST_AREA($)

Returns the area of a GEOMETRY object. For a POLYGON object, it calculates and returns its area. For a POINT or LINESTRING object, it returns 0. For a MULTI type GEOMETRY object, it calculates and returns the sum of the areas of internal GEOMETRY objects.

If the coordinate system is a rotating body, the area of the curved surface of the object is calculated in the unit of square meters. The calculation for the spheroid is the default. If you want faster calculations, change them to calculations for the spherical coordinate system.

  • Syntax

[Figure 2] ST_AREA

[Figure 2] ST_AREA

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

default

Calculation method. For a rotating body coordinate system, the spheroid is

calculated by default. If set to 0, a spherical coordinate system is calculated.

  • Example


ST_ASBINARY

Returns a GEOMETRY object as in Well Known Binary (WKB) format.

  • Syntax

[Figure 3] ST_ASBINARY

[Figure 3] ST_ASBINARY

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_ASGEOJSON

Returns a GEOMETRY object as in GEOJSON format.

  • Syntax

[Figure 4] ST_ASGEOJSON

[Figure 4] ST_ASGEOJSON

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

num1

Number of significant digits in the coordinate. (Default value: 9)

num2

Option of the GEOJASON format to return.

– 0: Adds no option.

– 1: Adds the minimum bounding rectangle of the GEOMETRY.

– 2: Displays the coordinate in Short CRS format. (Example: EPSG:4326)

– 4: Displays the coordinate in Long CRS format.(Example: urn:ogc:def:crs:EPSG::4326)

– 8: Displays the coordinate in Short CRS format if SRID is not 4326. (Default value)

  • Example


ST_ASGML

Returns a GEOMETRY object as in GML format.

  • Syntax

[Figure 5] ST_ASGML

[Figure 5] ST_ASGML

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

num1

Number of significant digits in the coordinate. (Default value: 15)

num2

Option of the GML format to return.

– 0: Displays the coordinate in Short CRS format. (Default value)

1: Displays the coordinate in Ling CRS format.

  • Example


ST_ASKML

Returns a GEOMETRY object as in KML format.

  • Syntax

[Figure 6] ST_ASKML

[Figure 6] ST_ASKML

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object. An error is returned if the object is

GEOMETRYCOLLECTION type.

num

Number of significant digits in the coordinate. (Default value: 15)

str

Namespace prefix of KML to return. The default namespace has no prefix.

  • Example


ST_ASTEXT

Returns a GEOMETRY object as in Well Known Text (WKT) format.

  • Syntax

[Figure 7] ST_ASTEXT

[Figure 7] ST_ASTEXT

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_ASTWKB(#)

Returns a GEOMETRY object as in Tiny Well Known Binary (TWKB) format.

  • Syntax

[Figure 8] ST_ASTWKB

[Figure 8] ST_ASTWKB

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

num1

Number of significant digits after the decimal point of the coordinate expressed

as TWKB. (Default value: 0)

num2

Determines whether to include the length of the encoded GEOMETRY object

in TWKB to return. The length is not included by default. If set to 1, it is included.

num3

Determines whether to include the bounding box of the GEOMETRY object in TWKB to return. The bounding box is not included by default. If set to 1, it is

included.

  • Example


ST_AZIMUTH($)

Measures the angle between the line segment that connects POINT object 1 and POINT object 2 and the vertical upper line segment of the POINT object 1 in a clockwise direction and returns it in arc degree unit. This corresponds to the North Pole azimuth on a rotating body coordinate system. This function can take GEOMETRY on a rotating body coordinate system and GEOMETRY on a plane coordinate system as arguments. If the type of the GEOMETRY object is not POINT, an exception is returned.

  • Syntax

[Figure 9] ST_AZIMUTH

[Figure 9] ST_AZIMUTH

  • Components

Component
Description

geom1

GEOMETRY type POINT object.

geom2

GEOMETRY type POINT object.

  • Example


ST_BOUNDARY

Returns the boundary of a given GEOMETRY object. If the type of the GEOMETRY object is GEOMETRYCOLLECTION, an error is returned.

  • Syntax

[Figure 10] ST_BOUNDARY

[Figure 10] ST_BOUNDARY

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_BUFFER($)

Returns a GEOMETRY object representing all points within a certain distance from a given GEOMETRY object. It can perform calculations on GEOMETRY objects on the rotating body coordinate system by using coordinate system information.

  • Syntax

[Figure 11] ST_BUFFER

[Figure 11] ST_BUFFER

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

expr

Expression meaning the distance from the given GEOMETRY object.

  • Example


ST_BUILDAREA(#)

Returns a POLYGON object that can be formed with line segment components of a given GEOMETRY object. If the line segment components cannot form a POLYGON object, NULL is returned.

  • Syntax

[Figure 12] ST_BUILDAREA

[Figure 12] ST_BUILDAREA

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_CENTROID($)

Returns the center of a given GEOMETRY object. It can perform calculations on GEOMETRY objects on the rotating body coordinate system by using coordinate system information. If you want faster calculations, change them to calculations for the spherical coordinate system.

  • Syntax

[Figure 13] ST_CENTROID

[Figure 13] ST_CENTROID

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

default

Calculation method. For a rotating body coordinate system, the spheroid is

calculated by default. If set to 0, a spherical coordinate system is calculated.

  • Example


ST_COLLECT

Groups GEOMETRY objects and returns the result as a MULTI type object. Since it is an aggregate function, it returns the result of grouping GEOMETRY objects. Its variant function can take two GEOMETRY objects as arguments.

  • Syntax

[Figure 14] ST_COLLECT

[Figure 14] ST_COLLECT

  • Components

Component
Description

geom

Expression indicating a GEOMETRY object.

  • Example

  • Example The following uses a table's geometry column as an argument.


ST_CONTAINS

Returns GEOMETRY object 1 if GEOMETRY object 2 does not exist outside of the GEOMETRY object 1 and at least one point exists inside the GEOMETRY object 1.

  • Syntax

[Figure 15] ST_CONTAINS

[Figure 15] ST_CONTAINS

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object that can include geom2.

geom2

GEOMETRY type GEOMETRY object that can be included in geom1.

  • Example


ST_CONVEXHULL

Returns the convex hull of a given GEOMETRY object. A convex hull means the smallest convex closed curve containing a GEOMETRY object.

  • Syntax

[Figure 16] ST_CONVEXHULL

[Figure 16] ST_CONVEXHULL

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_CROSSES

Returns 1 if two given GEOMETRY objects intersect. If one object includes another or their boundaries are touched, this is not regarded as they intersect.

  • Syntax

[Figure 17] ST_CROSSES

[Figure 17] ST_CROSSES

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object

geom2

GEOMETRY type GEOMETRY object

  • Example


ST_COVEREDBY(#)

Returns 1 if any point of GEOMETRY object 1 is not outside of GEOMETRY object 2. Its arguments must be GEOMETRY objects on a rotating body coordinate system. Otherwise, it returns an exception.

  • Syntax

[Figure 18] ST_COVEREDBY

[Figure 18] ST_COVEREDBY

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object

geom2

GEOMETRY type GEOMETRY object

  • Example


ST_COVERS(#)

Returns 1 if any point of GEOMETRY object 2 is not outside of GEOMETRY object 1. Its arguments must be GEOMETRY objects on a rotating body coordinate system. Otherwise, it returns an exception.

  • Syntax

[Figure 19] ST_COVERS

[Figure 19] ST_COVERS

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object

geom2

GEOMETRY type GEOMETRY object

  • Example


ST_DIFFERENCE($)

Returns the part of GEOMETRY object 1 that does not overlap with a GEOMETRY object 2. It can perform operations on GEOMETRY objects on the rotating body coordinate system by using coordinate system information.

  • Syntax

[Figure 20] ST_DIFFERENCE

[Figure 20] ST_DIFFERENCE

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object

geom2

GEOMETRY type GEOMETRY object

  • Example


ST_DIMENSION

Returns the dimension of a GEOMETRY object.

  • Syntax

[Figure 21] ST_DIMENSION

[Figure 21] ST_DIMENSION

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object

  • Example


ST_DISJOINT

Returns 1 if two GEOMETRY objects do not share any area.

  • Syntax

[Figure 22] ST_DISJOINT

[Figure 22] ST_DISJOINT

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object

geom2

GEOMETRY type GEOMETRY object

  • Example


ST_DISTANCE($)

Returns the shortest distance between two GEOMETRY objects. It can perform calculations on GEOMETRY objects on the rotating body coordinate system by using coordinate system information. If you want faster calculations, change them to calculations for the spherical coordinate system.

  • Syntax

[Figure 23] ST_DISTANCE

[Figure 23] ST_DISTANCE

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom2

GEOMETRY type GEOMETRY object.

default

Calculation method. For a rotating body coordinate system, the spheroid is

calculated by default. If set to 0, a spherical coordinate system is calculated.

  • Example


ST_DWITHIN #

Returns whether two GEOMETRY objects are within a specified distance. It can perform calculations on GEOMETRY objects on the rotating body coordinate system by using coordinate system information. If you want faster calculations, change them to calculations for the spherical coordinate system.

  • Syntax

[Figure 24] ST_DWITHIN

[Figure 24] ST_DWITHIN

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom2

GEOMETRY type GEOMETRY object.

num

Specified distance. For GEOMETRY, the unit of a set coordinate system is used.

For GEOGRAPHY, meter is the unit.

default

Calculation method. For a rotating body coordinate system, the spheroid is

calculated by default. If set to 0, a spherical coordinate system is calculated.

  • Example


ST_ENDPOINT

Returns the last point of a LINESTRING GEOMETRY object as a POINT object. If the argument is not LINESTRING, NULL is returned.

  • Syntax

[Figure 25] ST_ENDPOINT

[Figure 25] ST_ENDPOINT

  • Components

Component
Description

geom

GEOMETRY type LINESTRING object.

  • Example


ST_ENVELOPE

Returns a rectangle that surrounds a given GEOMETRY object as a POLYGON object.

  • Syntax

[Figure 26] ST_ENVELOPE

[Figure 26] ST_ENVELOPE

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object

  • Example


ST_EQUALS

Returns 1 if two GEOMETRY objects express the same GEOMETRY.

  • Syntax

[Figure 27] ST_EQUALS

[Figure 27] ST_EQUALS

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_EXTERIORRING

Returns the outer ring of a POLYGON GEOMETRY object. If the argument is not POLYGON, NULL is returned.

  • Syntax

[Figure 28] ST_EXTERIORRING

[Figure 28] ST_EXTERIORRING

  • Components

Component
Description

geom

GEOMETRY type POLYGON object.

  • Example


ST_EXPAND

Returns a POLYGON object of the bounding box where a given GEOMETRY object is extended in all directions. If the argument is an empty GEOMETRY object, NULL is returned regardless of its expansion.

  • Syntax

[Figure 29] ST_EXPAND

[Figure 29] ST_EXPAND

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

num1

Distance to extend in the X direction. Forms a POLYGON object extended to

the left and right as much as this distance.

num2

Distance to extend in the Y direction. Forms a POLYGON object extended to

the left and right as much as this distance.

  • Example


ST_EXTENT

Returns a POLYGON object of the bounding box that includes a GEOMETRY object. Since it is an aggregate function, it returns the result of grouping GEOMETRY objects.

  • Syntax

[Figure 30] ST_EXTENT

[Figure 30] ST_EXTENT

  • Components

Component
Description

geom_expr

Expression indicating a GEOMETRY object.

  • Example


ST_GEOMCOLLFROMTEXT

Returns a GEOMETRYCOLLECTION object based on given WKT and SRID.

  • Syntax

[Figure 31] ST_GEOMCOLLFROMTEXT

[Figure 31] ST_GEOMCOLLFROMTEXT

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type GEOMETRYCOLLECTION

object in WKT format.

num

Coordinate system information (SRID) of a GEOMETRYCOLLECTION object.

If SRID is not given, 0 (system's default coordinate system) is used.

  • Example


ST_GEOMCOLLFROMWKB

Returns a GEOMETRYCOLLECTION object based on given WKB and SRID.

  • Syntax

[Figure 32] ST_GEOMCOLLFROMWKB

[Figure 32] ST_GEOMCOLLFROMWKB

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type GEOMETRYCOLLECTION

object in WKB format.

num

Coordinate system information (SRID) of a GEOMETRYCOLLECTION object.

If SRID is not given, 0 (system's default coordinate system) is used.

  • Example


ST_GEOMETRYFROMTEXT

Returns a GEOMETRY object based on given WKB and SRID. TEXT in Extended Well-Known Text (EWKT) format that expresses 3D is also supported. Same as ST_GEOMFROMTEXT.

  • Syntax

[Figure 33] ST_GEOMETRYFROMTEXT

[Figure 33] ST_GEOMETRYFROMTEXT

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type GEOMETRY object in WKT

format.

num

Coordinate system information (SRID) of a GEOMETRY object. If SRID is not

given, 0 (system's default coordinate system) is used.

  • Example


ST_GEOMETRYN

Returns the N-th GEOMETRY object from GEOMETRYCOLLECTION, MULTIPOINT, MULTILINESTRING, and MULTIPOLYGON objects. If a non-MULTI GEOMETRY object is given as an argument, the GEOMETRY object is returned if N is 1, or NULL is returned if N is not 1. If N is greater than the number of GEOMETRY objects, NULL is returned.

  • Syntax

[Figure 34] ST_GEOMETRYN

[Figure 34] ST_GEOMETRYN

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

num

Order of the object (N-th).

  • Example


ST_GEOMETRYTYPE

Returns the type of a GEOMETRY object.

  • Syntax

[Figure 35] ST_GEOMETRYTYPE

[Figure 35] ST_GEOMETRYTYPE

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_GEOMFROMGEOJSON

Creates a GEOMETRY object from a given GEOJSON expression and returns it. Only JSON figure fragments can be taken as an argument. A complete JSON document cannot be taken as an argument.

  • Syntax

[Figure 36] ST_GEOMFROMGEOJSON

[Figure 36] ST_GEOMFROMGEOJSON

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type GEOMETRY object in

GEOJSON format.

  • Example


ST_GEOMFROMGML

Creates a GEOMETRY object from a given GML expression and returns it. Only GML figure fragments can be taken as an argument. A complete GML document cannot be taken as an argument.

  • Syntax

[Figure 37] ST_GEOMFROMGML

[Figure 37] ST_GEOMFROMGML

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type GEOMETRY object in GML

format.

num

Coordinate system information (SRID) of a GEOMETRY object. If SRID is not

given, 0 (system's default coordinate system) is used.

  • Example


ST_GEOMFROMKML

Creates a GEOMETRY object from a given KML expression and returns it. Only KML figure fragments can be taken as an argument. A complete KML document cannot be taken as an argument.

  • Syntax

[Figure 38] ST_GEOMFROMKML

[Figure 38] ST_GEOMFROMKML

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type GEOMETRY object in KML

format.

num

Coordinate system information (SRID) of a GEOMETRY object. If SRID is not given, 0 (system's default coordinate system) is used.

  • Example


ST_GEOMFROMTEXT

Returns a GEOMETRY object based on given WKB and SRID. TEXT in Extended Well-Known Text (EWKT) format that expresses 3D is also supported. Same as ST_GEOMETRYFROMTEXT.

  • Syntax

[Figure 39] ST_GEOMFROMTEXT

[Figure 39] ST_GEOMFROMTEXT

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type GEOMETRY object in WKT

format.

num

Coordinate system information (SRID) of a GEOMETRY object. If SRID is not

given, 0 (system's default coordinate system) is used.

  • Example


ST_GEOMFROMTWKB(#)

Returns a given TWKB as a GEOMETRY object.

  • Syntax

[Figure 40] ST_GEOMFROMTWKB

[Figure 40] ST_GEOMFROMTWKB

  • Components

Component
Description

str

Value of a binary type (BLOB or RAW) where TWKB format for GEOMETRY

objects is saved.

num

Coordinate system information (SRID) of a GEOMETRY object. If SRID is not

given, 0 (system's default coordinate system) is used.

  • Example


ST_GEOMFROMWKB

Returns given WKB and SRID as a GEOMETRY object.

  • Syntax

[Figure 41] ST_GEOMFROMWKB

[Figure 41] ST_GEOMFROMWKB

  • Components

Component
Description

str

Value of a binary type (BLOB or RAW) where TWKB format for GEOMETRY

objects is saved.

num

Coordinate system information (SRID) of a GEOMETRY object. If SRID is not

given, 0 (system's default coordinate system) is used.

  • Example


ST_INTERIORRINGN

Returns the N-th inner ring of a POLYGON object. If the argument is not POLYGON, NULL is returned. If N is greater than the number of the inner rings, NULL is returned.

  • Syntax

[Figure 42] ST_INTERIORRINGN

[Figure 42] ST_INTERIORRINGN

  • Components

Component
Description

geom

GEOMETRY type POLYGON object.

num

Order of the inner ring (N-th).

  • Example


ST_INTERSECTION($)

Returns a GEOMETRY object representing the part shared between GEOMETRY object 1 and GEOMETRY object 2. It can perform calculations on GEOMETRY objects on the rotating body coordinate system by using coordinate system information.

  • Syntax

[Figure 43] ST_INTERSECTION

[Figure 43] ST_INTERSECTION

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom2

GEOMETRY type GEOMETRY object.

  • Example


ST_INTERSECTS($)

Returns 1 if there is a part shared by two GEOMETRY objects. It can perform calculations on GEOMETRY objects on the rotating body coordinate system by using coordinate system information. If a given GEOMETRY argument is the GEOMETRYCOLLECTION type, a runtime error occurs.

  • Syntax

[Figure 44] ST_INTERSECTS

[Figure 44] ST_INTERSECTS

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom2

GEOMETRY type GEOMETRY object.

  • Example


ST_ISCLOSED

Returns 1 if the first point and the last point of a LINESTRING object are the same. It always returns 1 for a POINT or POLYGON object. For MULTI type GEOMETRY objects, it returns 1 when all internal GEOMETRY values are 1.

  • Syntax

[Figure 45] ST_ISCLOSED

[Figure 45] ST_ISCLOSED

  • Components

Component
Description

geom

GEOMETRY type LINESTRING object.

  • Example


ST_ISCOLLECTION

Returns 1 if a given GEOMETRY object is GEOMETRYCOLLECTION or MULTI GEOMETRY.

  • Syntax

[Figure 46] ST_ISCOLLECTION

[Figure 46] ST_ISCOLLECTION

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_ISEMPTY

Returns 1 if a given GEOMETRY object is the EMPTY type.

  • Syntax

[Figure 47] ST_ISEMPTY

[Figure 47] ST_ISEMPTY

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_ISRING

Returns 1 if a given LINESTRING object is closed (the first point and the last point are the same) and simple. If a non-LINESTRING GEOMETRY object is given as an argument, 0 is returned

  • Syntax

[Figure 48] ST_ISRING

[Figure 48] ST_ISRING

  • Components

Component
Description

geom

GEOMETRY type LINESTRING object.

  • Example


ST_ISSIMPLE

Returns 1 if a GEOMETRY object has no self-intersection or self-contact points. It returns an exception for GEOMETRYCOLLECTION.

  • Syntax

[Figure 49] ST_ISSIMPLE

[Figure 49] ST_ISSIMPLE

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_ISVALID

Checks whether a GEOMETRY object is spatially valid (well-formed). It returns 1 if spatially valid, otherwise it returns 0. It returns 1 for EMPTY spatial objects. For invalid objects, it returns the reason why the object is not spatially valid and the location.

  • Syntax

[Figure 50] ST_ISVALID

[Figure 50] ST_ISVALID

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_LENGTH($)

Returns the length of a LINESTRING object. It returns 0 for POINT and POLYGON. For a MULTI type GEOMETRY object, the sum of the calculation results of the internal GEOMETRY objects is returned. It can perform calculations on GEOMETRY objects on the rotating body coordinate system by using coordinate system information. If you want faster calculations, change them to calculations for the spherical coordinate system.

  • Syntax

[Figure 51] ST_LENGTH

[Figure 51] ST_LENGTH
  • Components

Component
Description

geom

GEOMETRY type LINESTRING object.

default

Calculation method. For a rotating body coordinate system, the spheroid is

calculated by default. If set to 0, a spherical coordinate system is calculated.

  • Example


ST_LINEFROMTEXT

Returns a LINESTRING object based on given WKT and SRID.

  • Syntax

[Figure 52] ST_LINEFROMTEXT

[Figure 52] ST_LINEFROMTEXT

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type LINESTRING object in WKT

format.

num

Coordinate system information (SRID) of a LINESTRING object. If SRID is not given, 0 (system's default coordinate system) is used.

  • Example


ST_LINEFROMWKB

Returns a LINESTRING object based on given WKB and SRID.

  • Syntax

[Figure 53] ST_LINEFROMWKB

[Figure 53] ST_LINEFROMWKB

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type LINESTRING object in WKB

format.

num

Coordinate system information (SRID) of a LINESTRING object. If SRID is not

given, 0 (system's default coordinate system) is used.

  • Example


ST_MAKEENVELOPE

Returns a rectangular POLYGON object formed with given minimum and maximum values.

  • Syntax

[Figure 54] ST_MAKEENVELOPE

[Figure 54] ST_MAKEENVELOPE

  • Components

Component
Description

num1

X coordinate of the minimum point (bottom left) of a rectangular POLYGON

object.

num2

Y coordinate of the minimum point (bottom left) of a rectangular POLYGON

object.

num3

X coordinate of the maximum point (top right) of a rectangular POLYGON object.

num4

Y coordinate of the maximum point (top right) of a rectangular POLYGON object.

  • Example


ST_MAKELINE

Takes POINT, MULTIPOINT, or LINESTRING as an argument and returns a LINESTRING object. Since it is an aggregate function, it returns the result of grouping GEOMETRY objects. You can set the type of the LINESTRING object by using an ORDER BY statement.

  • Syntax

[Figure 55] ST_MAKELINE

[Figure 55] ST_MAKELINE

  • Components

Component
Description

geom_expr

Expression indicating a GEOMETRY object. Must be a POINT, LINESTRING,

or MULTIPOINT type GEOMETRY object.

order_by_clause

How to sort GEOMETRY objects.

  • Example

  • Example The following uses a table's geometry column as an argument.

  • Example The following uses order_by_clause.


ST_MAKEPOINT

Returns a 2D POINT object.

  • Syntax

[Figure 56] ST_MAKEPOINT

[Figure 56] ST_MAKEPOINT

  • Components

Component
Description

num1

X coordinate of a POINT object.

num2

Y coordinate of a POINT object.

  • Example


ST_MAKEPOLYGON

Returns a POLYGON object formed with a given structure. The argument must be a closed LINESTRING.

  • Syntax

[Figure 57] ST_MAKEPOLYGON

[Figure 57] ST_MAKEPOLYGON

  • Components

Component
Description

geom1

GEOMETRY type LINESTRING object representing the SHELL of a POLYGON

object to be formed.

geom2

GEOMETRY type LINESTRING object representing the INTERIOR RING of a

POLYGON object to be formed. If there are multiple INTERIOR RINGs, it must be a GEOMETRY type MULTILINESTRING object.

  • Example


ST_MAKEVALID(#)

Changes an invalid GEOMETRY object to a valid object without loss of points and returns it. If a given object is already valid, it is returned as is.

  • Syntax

[Figure 58] ST_MAKEVALID

[Figure 58] ST_MAKEVALID

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_MAXX

Returns the larger value of the X coordinate values of the minimum bounding rectangle that surrounds a given spatial object.

  • Syntax

[Figure 59] ST_MAXX

[Figure 59] ST_MAXX

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_MAXY

Returns the larger value of the Y coordinate values of the minimum bounding rectangle that surrounds a given spatial object.

  • Syntax

[Figure 60] ST_MAXY

[Figure 60] ST_MAXY

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_MINX

Returns the smaller value of the X coordinate values of the minimum bounding rectangle that surrounds a given spatial object.

  • Syntax

[Figure 61] ST_MINX

[Figure 61] ST_MINX

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_MINY

Returns the smaller value of the Y coordinate values of the minimum bounding rectangle that surrounds a given spatial object.

  • Syntax

[Figure 62] ST_MINY

[Figure 62] ST_MINY

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_MLINEFROMTEXT

Returns a MULTILINESTRING object based on given WKT and SRID.

  • Syntax

[Figure 63] ST_MLINEFROMTEXT

[Figure 63] ST_MLINEFROMTEXT

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type MULTILINESTRING object

in WKT format.

num

Coordinate system information (SRID) of a MULTILINESTRING object. If SRID

is not given, 0 (system's default coordinate system) is used.

  • Example


ST_MLINEFROMWKB

Returns a MULTILINESTRING object based on given WKB and SRID.

  • Syntax

[Figure 64] ST_MLINEFROMWKB

[Figure 64] ST_MLINEFROMWKB

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type MULTILINESTRING object

in WKB format.

num

Coordinate system information (SRID) of a MULTILINESTRING object. If SRID

is not given, 0 (system's default coordinate system) is used.

  • Example


ST_MPOINTFROMTEXT

Returns a MULTIPOINT object based on given WKT and SRID.

  • Syntax

[Figure 65] ST_MPOINTFROMTEXT

[Figure 65] ST_MPOINTFROMTEXT

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type MULTIPOINT object in WKT

format.

num

Coordinate system information (SRID) of a MULTIPOINT object. If SRID is not

given, 0 (system's default coordinate system) is used.

  • Example


ST_MPOINTFROMWKB

Returns a MULTIPOINT object based on given WKB and SRID.

  • Syntax

[Figure 66] ST_MPOINTFROMWKB

[Figure 66] ST_MPOINTFROMWKB

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type MULTIPOINT object in WKB

format.

num

Coordinate system information (SRID) of a MULTIPOINT object. If SRID is not given, 0 (system's default coordinate system) is used.

  • Example


ST_MPOLYFROMTEXT

Returns a MULTIPOLYGON object based on given WKT and SRID.

  • Syntax

[Figure 67] ST_MPOLYFROMTEXT

[Figure 67] ST_MPOLYFROMTEXT

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type MULTIPOLYGON object in

WKT format.

num

Coordinate system information (SRID) of a MULTIPOLYGON object. If SRID is

not given, 0 (system's default coordinate system) is used.

  • Example


ST_MPOLYFROMWKB

Returns a MULTIPOLYGON object based on given WKB and SRID.

  • Syntax

[Figure 68] ST_MPOLYFROMWKB

[Figure 68] ST_MPOLYFROMWKB

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type MULTIPOLYGON object in

WKB format.

num

Coordinate system information (SRID) of a MULTIPOLYGON object. If SRID is

not given, 0 (system's default coordinate system) is used.

  • Example


ST_MULTI

Returns GEOMETRY as MULTI type GEOMETRY. If a MULTI type object is given as an argument, it is returned as is.

  • Syntax

[Figure 69] ST_MULTI

[Figure 69] ST_MULTI

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_NN($)

Used in a conditional clause. It returns 1 for rows that include a GEOMETRY object that is closest to a GEOMETRY object given as an argument for a table's GEOMETRY column. Rows are returned in order of shortest distance to longest.

  • Syntax

[Fiture 70] ST_NN

[Figure 70] ST_NN

  • Components

Component
Description

geom_expr

GEOMETRY type GEOMETRY object. Must be a GEOMETRY type column

where RTREE is built.

geom

GEOMETRY type GEOMETRY object.

str

Additional information for this function. CHAR, VARCAHR, NCHAR, or NVARCHAR type in WKT format.

str consists of the following 3 parameters delimited by a comma (,).

– res_num: Number of GEOMETRY objects for which 1 is returned. If not specified, 1 is returned for all columns.

– batch_size: Number of GEOMETRY objects to search from RTREE at once. Specify a value determined to be able to perform an efficient operation on a specific value. If not specified, the default value set for the system is used.

– distance: Distance set as a bottleneck. 1 is returned for rows within a distance less than or equal to this value.

– unit : Unit of the distance set as a bottleneck.

  • Example


ST_NPOINTS

Returns the number of POINTs in GEOMETRY. Same as ST_NUMPOINTS.

  • Syntax

[Figure 71] ST_NPOINTS

[Figure 71] ST_NPOINTS

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_NUMGEOMETRIES

Returns the number of GEOMETRY objects from GEOMETRYCOLLECTION, MULTIPOING, MULTILINESTRING, and MULTIPOLYGON objects. If a non-MULTI GEOMETRY object is given as an argument, 1 is returned.

  • Syntax

[Figure 72] ST_NUMGEOMETRIES

[Figure 72] ST_NUMGEOMETRIES

  • Components

Component
Description

geom

GEOMETRY type COLLECTION object.

  • Example


ST_NUMINTERIORRING

Returns the number of inner rings of a POLYGON object. If the argument is not POLYGON, NULL is returned.

  • Syntax

[Figure 73] ST_NUMINTERIORRING

[Figure 73] ST_NUMINTERIORRING

  • Components

Component
Description

geom

GEOMETRY type POLYGON object.

  • Example


ST_NUMPOINTS

Returns the number of POINTs in GEOMETRY. Same as ST_NPOINTS.

  • Syntax

[Figure 74] ST_NUMPOINTS

[Figure 74] ST_NUMPOINTS

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_OVERLAPS

Returns 1 if two given GEOMETRY objects have the same dimension, an overlapping part exists, and one object is not completely included in another object.

  • Syntax

[Figure 75] ST_OVERLAPS

[Figure 75] ST_OVERLAPS

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom2

GEOMETRY type GEOMETRY object.

  • Example


ST_POINT

Returns a 2D POINT object.

  • Syntax

[Figure 76] ST_POINT

[Figure 76] ST_POINT

  • Components

Component
Description

num1

X coordinate of a POINT object.

num2

Y coordinate of a POINT object.

  • Example


ST_POINTFROMTEXT

Returns a POINT object based on given WKT and SRID.

  • Syntax

[Figure 77] ST_POINTFROMTEXT

[Figure 77] ST_POINTFROMTEXT

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type POINT object in WKT format.

num

Coordinate system information (SRID) of a POINT object. If SRID is not given,

0 (system's default coordinate system) is used.

  • Example


ST_POINTFROMWKB

Returns a POINT object based on given WKB and SRID.

  • Syntax

[Figure 78] ST_POINTFROMWKB

[Figure 78] ST_POINTFROMWKB

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type POINT object in WKB format.

num

Coordinate system information (SRID) of a POINT object. If SRID is not given,

0 (system's default coordinate system) is used.

  • Example


ST_POINTN

Returns the N-th point of a LINESTRING object as a POINT object. If the argument is not LINESTRING, NULL is returned. -1 means the last POINT of the LINESTRING object. It is counted in the opposite direction, and a POINT object matching the negative argument is returned.

  • Syntax

[Figure 79] ST_POINTN

[Figure 79] ST_POINTN

  • Components

Component
Description

geom

GEOMETRY type LINESTRING object.

num

Order of the point (N-th).

  • Example


ST_POINTONSURFACE

Returns an arbitrary POINT object guaranteed to be placed on a spatial object.

  • Syntax

[Figure 80] ST_POINTONSURFACE

[Figure 80] ST_POINTONSURFACE

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_POLYFROMTEXT

Returns a POLYGON object based on given WKT and SRID.

  • Syntax

[Figure 81] ST_POLYFROMTEXT

[Figure 81] ST_POLYFROMTEXT

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type GEOMETRY POLYGON

object in WKT format.

num

Coordinate system information (SRID) of a POLYGON object. If SRID is not given, 0 (system's default coordinate system) is used.

  • Example


ST_POLYFROMWKB

Returns a POLYGON object based on given WKB and SRID.

  • Syntax

[Figure 82] ST_POLYFROMWKB

[Figure 82] ST_POLYFROMWKB

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type POLYGON object in WKB

format.

num

Coordinate system information (SRID) of a POLYGON object. If SRID is not

given, 0 (system's default coordinate system) is used.

  • Example


ST_POLYGON

Returns a POLYGON object formed with given LINESTRING and SRID. The argument must be a closed LINESTRING.

  • Syntax

[Figure 83] ST_POLYGON

[Figure 83] ST_POLYGON

  • Components

Component
Description

geom

GEOMETRY type LINESTRING object representing the outer SHELL of a POLYGON object to be formed. To form POLYGON with an internal hole, use

the ST_MAKEPOLYGON function.

num

Coordinate system information (SRID) of a POLYGON object to be formed.

  • Example


ST_POLYGONFROMTEXT

Returns a POLYGON object based on given WKT and SRID.

  • Syntax

[Figure 84] ST_POLYGONFROMTEXT

[Figure 84] ST_POLYGONFROMTEXT

  • Components

Component
Description

str

CHAR, VARCAHR, NCHAR, or NVARCHAR type POLYGON object in WKT

format.

num

Coordinate system information (SRID) of a POLYGON object. If SRID is not

given, 0 (system's default coordinate system) is used.

  • Example


ST_POLYGONIZE(#)

Returns POLYGON objects that can be formed from segment components of GEOMETRY sets. Since it is an aggregate function, it returns the result of grouping GEOMETRY objects.

  • Syntax

[Figure 85] ST_POLYGONIZE

[Figure 85] ST_POLYGONIZE

  • Components

Component
Description

geom_expr

Expression indicating a GEOMETRY object.

  • Example


ST_PROJECT(#)

Returns a POINT object projected from a POINT object in a given distance in meters and in a direction (azimuth) in arc degrees. Since the direction of the arc is set based on the azimuth, the east is expressed as /2, the south as , and the west as 3/2. Its arguments must be GEOMETRY objects on a rotating body coordinate system. Otherwise, it returns an exception. If a GEOMETRY object of a non-POINT type is inserted, an exception is returned.

  • Syntax

[Figure 86] ST_PROJECT

[Figure 86] ST_PROJECT

  • Components

Component
Description

geom

GEOMETRY type POINT object.

num1

Distance in meters.

num2

Azimuth in arc degrees.

  • Example


ST_RELATE

Returns 1 if GEOMETRY object 1 and GEOMETRY object 2 satisfy a given relationship. If a given GEOMETRY argument is the GEOMETRYCOLLECTION type, a runtime error occurs.

  • Syntax

[Figure 87] ST_RELATE

[Figure 87] ST_RELATE

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom2

GEOMETRY type GEOMETRY object.

str

CHAR, VARCAHR, NCHAR, or NVARCHAR string that represents the

relationship between two objects.

  • Example


ST_REVERSE

Returns a GEOMETRY object whose vertex order is reversed for a given GEOMETRY object.

  • Syntax

[Figure 88] ST_REVERSE

[Figure 88] ST_REVERSE

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_SETSRID

Sets and returns SRID of a given GEOMETRY object.

  • Syntax

[Figure 89] ST_SETSRID

[Figure 89] ST_SETSRID

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

num

Coordinate system information (SRID) to set.

  • Example


ST_SPLIT(#)

Returns a GEOMETRYCOLLECTION object obtained by dividing GEOMETRY by base GEOMETRY. LINESTRING can be divided by (MULTI)POINT, (MULTI)LINESTRING, (MULTI)POLYGON, and POLYGON can be divided by (MULTI)LINESTRING.

  • Syntax

[Figure 90] ST_SPLIT

[Figure 90] ST_SPLIT

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object. GEOMETRY to be divided.

geom2

GEOMETRY type GEOMETRY object. Base GEOMETRY.

  • Example


ST_SRID

Returns SRID of a given GEOMETRY object.

  • Syntax

[Figure 91] ST_SRID

[Figure 91] ST_SRID

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example


ST_STARTPOINT

Returns the first POINT of LINESTRING. If the argument is not LINESTRING, NULL is returned.

  • Syntax

[Figure 92] ST_STARTPOINT

[Figure 92] ST_STARTPOINT

  • Components

Component
Description

geom

GEOMETRY type LINESTRING object.

  • Example


ST_SYMDIFFERENCE($)

Returns a GEOMETRY object representing the area excluding intersection of two given GEOMETRY objects. It can perform calculations on GEOMETRY objects on the rotating body coordinate system by using coordinate system information.

  • Syntax

[Figure 93] ST_SYMDIFFERENCE

[Figure 93] ST_SYMDIFFERENCE

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom2

GEOMETRY type GEOMETRY object.

  • Example


ST_TOUCHES

Returns 1 when two given GEOMETRY objects share one or more points, but there is no intersection. If a given GEOMETRY argument is the GEOMETRYCOLLECTION type, a runtime error occurs.

  • Syntax

[Figure 94] ST_TOUCHES

[Figure 94] ST_TOUCHES

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom2

GEOMETRY type GEOMETRY object.

  • Example


ST_TRANSFORM(#)

Returns a GEOMETRY object that has an input GEOMETRY's coordinate converted to another spatial reference system. SRID and PROJ4TEXT are used as arguments. ST_TRANSFORM converts coordinates, but ST_SETSRI only sets SRID without converting coordinates.

  • Syntax

[Figure 95] ST_TRANSFORM

[Figure 95] ST_TRANSFORM

  • Components

- case1

Component
Description

geom

GEOMETRY type GEOMETRY object.

num

Coordinate system information (SRID) to convert.

- case2

Component
Description

geom

GEOMETRY type GEOMETRY object.

str

PROJ4TEXT of coordinate system information to convert.

- case3

Component
Description

geom

GEOMETRY type GEOMETRY object.

str

PROJ4TEXT of coordinate system information before conversion.

str

PROJ4TEXT of coordinate system information to convert.

- case4

Component
Description

geom

GEOMETRY type GEOMETRY object.

str

PROJ4TEXT of coordinate system information before conversion.

num

Coordinate system information (SRID) to convert.

  • Example


ST_TRANSLATE(#)

Returns GEOMETRY shifted by a given offset.

  • Syntax

[Figure 96] ST_TRANSLATE

[Figure 96] ST_TRANSLATE

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

num1

Offset to shift in the X direction.

num2

Offset to shift in the Y direction.

  • Example


ST_UNION($)

Returns a GEOMETRY object that sums the areas of two given GEOMETRY objects. It can perform calculations on GEOMETRY objects on the rotating body coordinate system by using coordinate system information.

  • Syntax

[Figure 97] ST_UNION

[Figure 97] ST_UNION

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom2

GEOMETRY type GEOMETRY object.

  • Example


ST_WITHIN

Takes two GEOMETRY objects and returns 1 if the first object completely contains the second object.

  • Syntax

[Figure 98] ST_WITHIN

[Figure 98] ST_WITHIN

  • Components

Component
Description

geom1

GEOMETRY type GEOMETRY object.

geom2

GEOMETRY type GEOMETRY object.

  • Example


ST_X

Returns the X coordinate of a POINT object. If the argument is not POINT, NULL is returned.

  • Syntax

[Figure 99] ST_X

[Figure 99] ST_X

  • Components

Component
Description

point

GEOMETRY type POINT object.

  • Example


ST_Y

Returns the Y coordinate of a POINT object. If the argument is not POINT, NULL is returned.

  • Syntax

[Figure 100] ST_Y

[Figure 100] ST_Y

  • Components

Component
Description

point

GEOMETRY type POINT object.

  • Example


DBMS_GEOM Package

Tibero Spatial supports additional functions through the DBMS_GEOM package.

ST_DUMPPOINTS

Returns a set consisting of GEOMETRY and an integer array (path).

Sets all POINTs of an argument GEOMETRY object and an integer array. For example, if LINESTRING is given as an argument, a path is set to {i}, where i is the i-th POINT of the LINESTRING. If POLYGON is given as argument, a path is set to {i,j}, where i is the i-th ring, and j is the j-th POINT of the i-th ring. If the MULTI type is given as an argument, an integer indicating that it is the n-th GEOMETRY is added to the front of each path.

  • Syntax

[Figure 101] ST_DUMPPOINTS

[Figure 101] ST_DUMPPOINTS

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

  • Example

FROM_WGS84

Converts a GEOMETRY object expressed with latitude and longitude in wgs84 format into a GEOMETRY object expressed with horizontal and vertical axes based on a given point. At this time, the coordinate of the GEOMETRY object is analyzed in the order of longitude and latitude, but this function takes the base point in the order of latitude and longitude.

The FROM_WGS84 and TO_WGS84 functions repeatedly perform floating-point operations. Therefore, distortion of the coordinate information of GEOMETRY type objects may occur. In addition, there is a difference in output results for each execution environment depending on floating-point operation methods.

  • Syntax

[Figure 102] FROM_WGS84

[Figure 107] FROM_WGS84

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

latitude

NUMBER type latitude value used as a base for conversion.

longitude

NUMBER type longitude value used as a base for conversion.

  • Example

TO_WGS84

Converts a GEOMETRY object expressed with horizontal and vertical axes into a GEOMETRY object expressed with latitude and longitude in wgs84 format based on a given point. At this time, the coordinate of the GEOMETRY object is analyzed in the order of longitude and latitude, but this function takes the base point in the order of latitude and longitude.

The FROM_WGS84 and TO_WGS84 functions repeatedly perform floating-point operations. Therefore, distortion of the coordinate information of GEOMETRY type objects may occur. In addition, there is a difference in output results for each execution environment depending on floating-point operation methods.

  • Syntax

[Figure 103] TO_WGS84

[Figure 114] TO_WGS84

  • Components

Component
Description

geom

GEOMETRY type GEOMETRY object.

latitude

NUMBER type latitude value used as a base for conversion.

longitude

NUMBER type longitude value used as a base for conversion.

  • Example

Last updated