Use constructor functions to build geometry objects from coordinates or Well-Known Text (WKT) strings. These functions are part of Lindorm GanosBase and apply only to the LindormTable engine.
Engines and versions
Constructor functions apply only to LindormTable.
LindormTable 2.6.5 or later is required.
Lindorm SQL 2.6.8 or later is required.
For instructions on checking or upgrading your version, see Release notes of LindormTable and Upgrade the minor engine version of a Lindorm instance. For information about how to view the Lindorm SQL version, see SQL versions.
Functions
| Function | Description |
|---|---|
| ST_GeomFromText | Converts a WKT string to a geometry object. |
| ST_LineFromMultiPoint | Converts a MultiPoint object to a LineString. |
| ST_MakePoint | Constructs a Point from longitude and latitude coordinates. |
ST_GeomFromText
Converts a WKT string to a geometry object. Use this function when your input is already in WKT format. To construct a Point directly from numeric coordinates, use ST_MakePoint instead — it is simpler and does not require string parsing.
Syntax
geometry ST_GeomFromText(string wkt)Parameters
| Parameter | Type | Description |
|---|---|---|
wkt | STRING | A WKT string representing a geometry object. |
Returns
A geometry object corresponding to the input WKT string.
Usage notes:
Supported geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.
WKT strings that embed spatial reference system (SRS) information are not supported. If your geometry has a Spatial Reference Identifier (SRID), store it in a separate column. The SRID is used only as an identifier. The default SRID is 4326.
EMPTY objects are supported for any geometry type (for example,
'POLYGON EMPTY').
Examples
Example 1: Point
SELECT ST_GeomFromText('POINT(1 1)') AS geom;Result:
+-------------+
| geom |
+-------------+
| POINT (1 1) |
+-------------+Example 2: Polygon
SELECT ST_GeomFromText('POLYGON (( 1 1, 1 2, 2 2, 2 1, 1 1))') AS poly;Result:
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| poly |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 0020000003000010E600000001000000053FF00000000000003FF00000000000003FF000000000000040000000000000004000000000000000400000000000000040000000000000003FF00000000000003FF00000000000003FF0000000000000 |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+Example 3: EMPTY geometry
SELECT ST_GeomFromText('POLYGON EMPTY') AS geom;Result:
+---------------+
| geom |
+---------------+
| POLYGON EMPTY |
+---------------+ST_LineFromMultiPoint
Converts a MultiPoint object to a LineString. Because this function takes a MultiPoint as input (not individual Point values), use ST_Collect to combine Point objects into a MultiPoint before calling this function.
Syntax
geometry ST_LineFromMultiPoint(geometry aMultiPoint)Parameters
| Parameter | Type | Description |
|---|---|---|
aMultiPoint | GEOMETRY (MultiPoint) | A MultiPoint object. Use ST_Collect to build a MultiPoint from individual Point objects. |
Returns
A geometry object of subtype LineString.
Example
SELECT ST_AsText(
ST_LineFromMultiPoint(
ST_Collect(
ST_MakePoint(1, 2),
ST_MakePoint(3, 4),
ST_MakePoint(5, 6)
)
)
) AS astext;Result:
+-------------------------+
| astext |
+-------------------------+
| LINESTRING(1 2,3 4,5 6) |
+-------------------------+ST_MakePoint
Constructs a Point geometry from longitude (x) and latitude (y) coordinates. Use this function when your input is numeric coordinate values. This function only supports 2D points and does not support setting a spatial reference system.
Syntax
geometry ST_MakePoint(double x, double y)This function supports 2D points only. 3D points and spatial reference system configuration are not supported.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | DOUBLE | The longitude value. INTEGER and LONG values are automatically converted to DOUBLE. |
y | DOUBLE | The latitude value. INTEGER and LONG values are automatically converted to DOUBLE. |
Returns
A geometry object of subtype Point.
Example
SELECT ST_AsText(ST_MakePoint(1, 2)) AS text;Result:
+-------------+
| text |
+-------------+
| POINT (1 2) |
+-------------+