All Products
Search
Document Center

Lindorm:Access functions

Last Updated:Oct 18, 2024

This topic describes the access functions supported by Lindorm GanosBase.

Applicable engines and versions

The access functions described in this topic are applicable only to all versions of LindormTable.

Supported access functions

The following table lists the access functions supported by Lindorm GanosBase.

Function

Description

ST_Centroid

Returns the centroid of the specified geometry object.

ST_EndPoint

Returns the last point of the specified LineString object.

ST_NPoints

Returns the number of vertexes in the specified geometry object.

ST_StartPoint

Returns the start point of the specified LineString object.

ST_X

Returns the x coordinate of the specified point object.

ST_XMax

Returns the maximum x coordinate on the bounding box of the specified geometry object.

ST_XMin

Returns the minimum x coordinate on the bounding box of the specified geometry object.

ST_Y

Returns the y coordinate of the specified point object.

ST_YMax

Returns the maximum y coordinate on the bounding box of the specified geometry object.

ST_YMin

Returns the minimum y coordinate on the bounding box of the specified geometry object.

ST_Centroid

The ST_Centroid function returns the centroid of the specified geometry object.

Syntax

geometry ST_Centroid(geometry g)

Parameters

Parameter

Description

g

The geometry object whose centroid you want to obtain.

Note

If the object is an empty geometry, the corresponding empty geometry is returned.

Examples

  • Example 1:

    SELECT ST_AsText(ST_Centroid(ST_Collect(ST_MakePoint(1,1),ST_MakePoint(-1,-1)))) AS astext;

    The following result is returned:

    +-------------+
    |   astext    |
    +-------------+
    | POINT (0 0) |
    +-------------+
  • Example 2:

    SELECT ST_AsText(ST_Centroid(ST_GeomFromText('LINESTRING(0 0,0 1,1 2)'))) AS astext;

    The following result is returned:

    +--------------------------------+
    |             astext             |
    +--------------------------------+
    | POINT (0.2928932188134525      |
    | 1.085786437626905)             |
    +--------------------------------+

ST_EndPoint

The ST_EndPoint function returns the last point of the specified LineString object.

Syntax

geometry ST_EndPoint(geometry g)

Parameters

Parameter

Description

g

The geometry object whose last point you want to obtain.

Note

If the specified geometry object is not a LineString object, this function returns NULL.

Examples

SELECT ST_AsText(ST_EndPoint(ST_GEOMFROMTEXT('LINESTRING(1 1, 2 2, 3 3)'))) AS endpoint;

The following result is returned:

+-------------+
|  endpoint   |
+-------------+
| POINT (3 3) |
+-------------+

ST_NPoints

The ST_NPoints function returns the number of vertexes in the specified geometry object. This function is applicable to all types of supported geometry objects.

Syntax

int ST_NPoints(geometry g)

Parameters

Parameter

Description

g

The geometry object whose number of vertexes you want to query.

Examples

SELECT ST_NPoints(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)')) AS npoints;

The following result is returned:

+---------+
| npoints |
+---------+
| 4       |
+---------+

ST_StartPoint

The ST_StartPoint function returns the start point of the specified LineString object.

Syntax

geometry ST_StartPoint(geometry g)

Parameters

Parameter

Description

g

The geometry object whose start point you want to obtain.

Note

If the specified geometry object is not a LineString object, this function returns NULL.

Examples

SELECT ST_AsText(ST_StartPoint(ST_GEOMFROMTEXT('LINESTRING(0 1, 0 2)'))) AS startpoint;

The following result is returned:

+-------------+
| startpoint  |
+-------------+
| POINT (0 1) |
+-------------+

ST_X

The ST_X function returns the x coordinate of the specified point object.

Syntax

double ST_X(geometry a_point)

Parameters

Parameter

Description

a_point

The geometry object whose x coordinate you want to obtain.

Note

The specified geometry object must be a point object. If you set this parameter to EMPTY or NULL, this function returns NULL.

Examples

SELECT ST_X(ST_MakePoint(1.0, 2.0)) AS x;

The following result is returned:

+---+
| x |
+---+
| 1 |
+---+

ST_XMax

The ST_XMax function returns the maximum x coordinate on the bounding box of the specified geometry object.

Syntax

double ST_XMax(geometry g)

Parameters

Parameter

Description

g

The geometry object of which the maximum x coordinate on the bounding box you want to obtain.

Note
  • You can specify a geometry object of the following types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.

  • If you set this parameter to EMPTY, this function returns -1.

Examples

SELECT ST_XMax(ST_GeomFromText('LINESTRING(1 3,5 6)')) AS xmax;

The following result is returned:

+------+
| xmax |
+------+
| 5    |
+------+

ST_XMin

The ST_XMin function returns the minimum x coordinate on the bounding box of the specified geometry object.

Syntax

double ST_XMin(geometry g)

Parameters

Parameter

Description

g

The geometry object of which the minimum x coordinate on the bounding box you want to obtain.

Note
  • You can specify a geometry object of the following types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.

  • If you set this parameter to EMPTY, this function returns 0.

Examples

SELECT ST_XMin(ST_GeomFromText('LINESTRING(1 3,5 6)')) AS xmin;

The following result is returned:

+------+
| xmin |
+------+
| 1    |
+------+

ST_Y

The ST_Y function returns the y coordinate of the specified point object.

Syntax

double ST_Y(geometry a_point)

Parameters

Parameter

Description

a_point

The geometry object whose y coordinate you want to obtain.

Note

The specified geometry object must be a point object. If you set this parameter to EMPTY or NULL, this function returns NULL.

Examples

SELECT ST_Y(ST_MakePoint(1.0, 2.0)) AS y;

The following result is returned:

+---+
| y |
+---+
| 2 |
+---+

ST_YMax

The ST_YMax function returns the maximum y coordinate on the bounding box of the specified geometry object.

Syntax

double ST_YMax(geometry g)

Parameters

Parameter

Description

g

The geometry object of which the maximum y coordinate on the bounding box you want to obtain.

Note
  • You can specify a geometry object of the following types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.

  • If you set this parameter to EMPTY, this function returns -1.

Examples

SELECT ST_YMax(ST_GeomFromText('LINESTRING(1 3,5 6)')) AS ymax;

The following result is returned:

+------+
| ymax |
+------+
| 6    |
+------+

ST_YMin

The ST_YMin function returns the minimum y coordinate on the bounding box of the specified geometry object.

Syntax

double ST_YMin(geometry g)

Parameters

Parameter

Description

g

The geometry object of which the minimum y coordinate on the bounding box you want to obtain.

Note
  • You can specify a geometry object of the following types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.

  • If you set this parameter to EMPTY, this function returns 0.

Examples

SELECT ST_YMin(ST_GeomFromText('LINESTRING(1 3,5 6)')) AS ymin;

The following result is returned:

+------+
| ymin |
+------+
| 3    |
+------+