Linestring Functions
OcientGeo™ LINESTRING functions can perform alterations or access descriptive information on LINESTRING objects.
ST_ADDPOINT
Adds a POINT to the given LINESTRING at the specified 0-indexed location.
Syntax
Example
Output: LINESTRING(1.000000 2.000000, 1.000000 4.000000, 1.000000 3.000000)
ST_ENDPOINT
Returns the endpoint of a specified LINESTRING. The returned value is a POINT.
Syntax
Example
Output: POINT(1,4)
ST_LINEINTERPOLATEPOINT
Returns a POINT along a LINESTRING based on a specified fraction of its total length.
Syntax
Example
In this example, the function computes a point halfway (0.5) along the specified line.
Output: POINT(1.5 1.5)
ST_LINELOCATEPOINT
Similar to ST_LINEINTERPOLATEPOINT, this function computes a fraction based on where a specified POINT is located along the length of a specified LINESTRING.
Syntax
Example
In this example, the function computes a fraction that represents where the point (1.5, 1.5) lies along the line.
Output: 0.5
ST_LINESUBSTRING
Returns a LINESTRING that is a substring of a specified line that starts and ends at the specified fractions of its total length.
Syntax
Example
In this example, the function generates a subsection of the provided linestring, spanning from the start_fraction value (0.5) that represents the halfway point of the original linestring, to the end_fraction value (1.0) that represents the endpoint.
Output: LINESTRING(1.50 1.50, 2.0 1.0)
ST_POINTN
Returns the POINT value at a specified index of the specified LINESTRING. If out of bounds, the function returns NULL.
Syntax
Example
Output: ST_POINT(1,4)
ST_REMOVEPOINT
Removes a POINT value at a specified index from the specified line.
Syntax
Example
Output: LINESTRING(1.0 2.0, 1.0 4.0)
ST_SETPOINT
Replaces a POINT value in a specified LINESTRING at a specified index. The function returns the altered LINESTRING with the replaced point.
Syntax
Example
In this example, the function replaces the point value located at the -2 index location, meaning it is the second from the last in the sequence.
Output: LINESTRING(1.000000 2.000000, 1.000000 5.000000, 1.000000 4.000000)
ST_STARTPOINT
Returns the starting POINT value of the line. If this value is empty, the function returns NULL. If you specify a POLYGON, POINT, or NULL, then the function returns NULL. If you specify a non-geography value, the function throws an error.
Syntax
Example
Output: ST_POINT(1,2)

