All pages
Powered by GitBook
1 of 10

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

LineString Properties

Learn about LINESTRING properties in MariaDB Server. This section details SQL functions for retrieving attributes of linear spatial objects, such as length, number of points, and start/end points.

ST_NUMPOINTS

Returns the count of Points in a LineString. This function calculates the total number of vertices defining the line.

Syntax

ST_NumPoints(ls)
NumPoints(ls)

Description

Returns the number of Point objects in the LineString value ls.

ST_NumPoints() and NumPoints() are synonyms.

Examples

This page is licensed: GPLv2, originally from

ENDPOINT

Synonym for ST_ENDPOINT. Returns the last point of a LineString geometry.

A synonym for ST_ENDPOINT.

This page is licensed: CC BY-SA / Gnu FDL

SET @ls = 'LineString(1 1,2 2,3 3)';

SELECT NumPoints(GeomFromText(@ls));
+------------------------------+
| NumPoints(GeomFromText(@ls)) |
+------------------------------+
|                            3 |
+------------------------------+
fill_help_tables.sql

STARTPOINT

Synonym for ST_STARTPOINT. Returns the first point of a LineString geometry.

A synonym for ST_STARTPOINT.

This page is licensed: CC BY-SA / Gnu FDL

PointN

Synonym for ST_POINTN. Returns the N-th point in a LineString geometry, where N is a 1-based index.

A synonym for ST_PointN.

This page is licensed: CC BY-SA / Gnu FDL

ST_ENDPOINT

Returns the end Point of a LineString. This function retrieves the final coordinate in the linear geometry sequence.

Syntax

Description

Returns the that is the endpoint of the value ls

.

ST_EndPoint() and EndPoint() are synonyms.

Examples

This page is licensed: GPLv2, originally from fill_help_tables.sql

ST_EndPoint(ls)
EndPoint(ls)
Point
LineString
SET @ls = 'LineString(1 1,2 2,3 3)';

SELECT AsText(EndPoint(GeomFromText(@ls)));
+-------------------------------------+
| AsText(EndPoint(GeomFromText(@ls))) |
+-------------------------------------+
| POINT(3 3)                          |
+-------------------------------------+

ST_STARTPOINT

Returns the start Point of a LineString. This function retrieves the initial coordinate in the linear geometry sequence.

Syntax

ST_StartPoint(ls)
StartPoint(ls)

Description

Returns the Point that is the start point of the LineString value ls.

ST_StartPoint() and StartPoint() are synonyms.

Examples

This page is licensed: GPLv2, originally from

NumPoints

Synonym for ST_NUMPOINTS. Returns the number of points in a LineString geometry.

A synonym for ST_NumPoints.

This page is licensed: CC BY-SA / Gnu FDL

SET @ls = 'LineString(1 1,2 2,3 3)';

SELECT AsText(StartPoint(GeomFromText(@ls)));
+---------------------------------------+
| AsText(StartPoint(GeomFromText(@ls))) |
+---------------------------------------+
| POINT(1 1)                            |
+---------------------------------------+
fill_help_tables.sql

GLENGTH

Synonym for ST_LENGTH. Calculates the length of a LineString or MultiLineString in its associated spatial reference units.

Syntax

GLength(ls)

Description

Returns as a double-precision number the length of the LineString value ls in its associated spatial reference.

Examples

See Also

  • is the OpenGIS equivalent.

This page is licensed: GPLv2, originally from

SET @ls = 'LineString(1 1,2 2,3 3)';

SELECT GLength(GeomFromText(@ls));
+----------------------------+
| GLength(GeomFromText(@ls)) |
+----------------------------+
|           2.82842712474619 |
+----------------------------+
ST_LENGTH()
fill_help_tables.sql

ST_POINTN

Returns the N-th Point in a LineString. This function retrieves a specific point from the sequence based on its 1-based index.

Syntax

ST_PointN(ls,N)
PointN(ls,N)

Description

Returns the N-th Point in the LineString value ls. Points are numbered beginning with 1.

ST_PointN() and PointN() are synonyms.

Examples

This page is licensed: GPLv2, originally from

SET @ls = 'LineString(1 1,2 2,3 3)';

SELECT AsText(PointN(GeomFromText(@ls),2));
+-------------------------------------+
| AsText(PointN(GeomFromText(@ls),2)) |
+-------------------------------------+
| POINT(2 2)                          |
+-------------------------------------+
fill_help_tables.sql