This topic describes the constructor functions for spatio-temporal data. You can use these functions to build specific geometry objects or convert existing Well-known Text (WKT) strings and objects into other geometry formats.
Engines and versions
Constructor functions apply only to LindormTable.
The aggregate functions described in this topic are supported by LindormTable 2.6.5 and later versions. For more information about how to view or upgrade the version of LindormTable, see Release notes of LindormTable and Upgrade the minor engine version of a Lindorm instance.
Lindorm SQL must be version 2.6.8 or later. For more information about how to view the Lindorm SQL version, see SQL versions.
Functions
The following table lists the constructor functions that are supported by Lindorm GanosBase.
Function | Description |
Returns a Geometry object that corresponds to the specified WKT string. | |
Returns a LineString object that corresponds to the specified MultiPoint object. | |
Constructs a Point object. |
ST_GeomFromText
Returns a Geometry object that corresponds to the specified WKT string.
Syntax
geometry ST_GeomFromText(string wkt)Parameters
Parameter | Description |
wkt | The specified WKT string. |
The Geometry object supports the following types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.
WKT strings that contain spatial reference system information are not supported. If the WKT format includes a Spatial Reference Identifier (SRID), you must store the SRID in a separate column. The SRID is used only as an identifier. The default SRID is 4326.
You can create an EMPTY object of any data type.
Examples
Example 1: The Geometry object is a Point.
SELECT ST_GeomFromText('POINT(1 1)') as geom;The following result is returned:
+-------------+ | geom | +-------------+ | POINT (1 1) | +-------------+Example 2: The Geometry object is a Polygon.
SELECT ST_GeomFromText('POLYGON (( 1 1, 1 2, 2 2, 2 1, 1 1))') AS poly;The following result is returned:
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | poly | +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | 0020000003000010E600000001000000053FF00000000000003FF00000000000003FF000000000000040000000000000004000000000000000400000000000000040000000000000003FF00000000000003FF00000000000003FF0000000000000 | +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+Example 3: The Geometry object is EMPTY.
SELECT ST_GeomFromText('POLYGON EMPTY') as geom;The following result is returned:
+---------------+ | geom | +---------------+ | POLYGON EMPTY | +---------------+
ST_LineFromMultiPoint
Returns a LineString object that corresponds to the specified MultiPoint object.
Syntax
geometry ST_LineFromMultiPoint(geometry aMultiPoint)Parameters
Parameter | Description |
aMultiPoint | The specified MultiPoint object. You can use the |
Example
SELECT ST_AsText(ST_LineFromMultiPoint(ST_Collect(ST_MakePoint(1,2),ST_MakePoint(3,4),ST_MakePoint(5,6)))) AS astext;The following result is returned:
+-------------------------+
| astext |
+-------------------------+
| LINESTRING(1 2,3 4,5 6) |
+-------------------------+ST_MakePoint
Constructs a Point object.
Syntax
geometry ST_MakePoint(double x, double y)Parameters
Parameter | Description |
x | The longitude value x. The value must be of the DOUBLE type. If you enter a value of the INTEGER or LONG type, it is automatically converted to the DOUBLE type. |
y | The latitude value y. The value must be of the DOUBLE type. If you enter a value of the INTEGER or LONG type, it is automatically converted to the DOUBLE type. |
This function does not support setting a spatial reference system or creating 3D objects.
Example
SELECT ST_AsText(ST_MakePoint(1, 2)) as text;The following result is returned:
+-------------+
| text |
+-------------+
| POINT (1 2) |
+-------------+