All Products
Search
Document Center

Lindorm:Constructor functions

Last Updated:Apr 30, 2024

This topic describes the geometry constructor functions supported by Lindorm Ganos.

Applicable engines and versions

Important

The Lindorm SQL version must be 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 supported by Lindorm Ganos.

Function

Description

ST_GeomFromText

Constructs a geometry object based on the specified Well-known Text (WKT) string.

ST_LineFromMultiPoint

Constructs a LineString object based on the specified MultiPoint object.

ST_MakePoint

Constructs a point object.

ST_GeomFromText

The ST_GeomFromText function constructs a geometry object based on the specified Well-known Text (WKT) string.

Syntax

geometry ST_GeomFromText(string wkt)

Parameters

Parameter

Description

wkt

The WKT string based on which you want to construct a geometry object.

Note
  • You can construct the following types of objects by calling this function: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon and GeometryCollection.

  • This function does not support WKT strings that include Spatial Reference Identifiers (SRIDs). You can create a column in the database to store the SRIDs (4326 by default) of the geometry objects that you construct.

  • You can construct an empty geometry object of any supported data type.

Examples

  • Example 1: Construct a point object.

    SELECT ST_GeomFromText('POINT(1 1)') as geom;

    The following result is returned:

    +-------------+
    |    geom     |
    +-------------+
    | POINT (1 1) |
    +-------------+
  • Example 2: Construct a polygon object.

    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: Construct an empty polygon object.

    SELECT ST_GeomFromText('POLYGON EMPTY') as geom;

    The following result is returned:

    +---------------+
    |     geom      |
    +---------------+
    | POLYGON EMPTY |
    +---------------+

ST_LineFromMultiPoint

The ST_LineFromMultiPoint function constructs a LineString object based on the specified MultiPoint object.

Syntax

geometry ST_LineFromMultiPoint(geometry aMultiPoint)

Parameters

Parameter

Description

aMultiPoint

You can call the ST_Collect function to combine multiple specified point objects into a MultiPoint object.

Examples

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

The ST_MakePoint function constructs a point object.

Syntax

geometry ST_MakePoint(double x, double y)

Parameters

Parameter

Description

x

The longitude of the point object that you want to construct. The value of this parameter is a number of the DOUBLE type. If you specify a number of the INTEGER or LONG type, it is automatically converted to the DOUBLE type.

y

The latitude of the point object that you want to construct. The value of this parameter is a number of the DOUBLE type. If you specify a number of the INTEGER or LONG type, it is automatically converted to the DOUBLE type.

Note

This function can be used to construct only 2D point objects without Spatial Reference System (SRS) information.

Examples

SELECT ST_AsText(ST_MakePoint(1, 2)) as text;

The following result is returned:

+-------------+
|    text     |
+-------------+
| POINT (1 2) |
+-------------+