ST_PointAtDistance function

The ST_PointAtDistance function takes a curve or multi-curve geometry and a distance as input parameters and returns the point geometry at the given distance along the curve geometry.

This function can also be called as a method.

Syntax

Read syntax diagramSkip visual syntax diagramdb2gse.ST_PointAtDistance(geometry,distance )

Parameter

geometry
A value of type ST_Curve or ST_MultiCurve or one of its subtypes that represents the geometry to process.
distance
A value of type DOUBLE that is the distance along the geometry to locate the point.

Return type

db2gse.ST_Point

Examples

The following SQL statement creates the SAMPLE_GEOMETRIES table with two columns. The ID column uniquely identifies each row. The GEOMETRY ST_LineString column stores sample geometries.
SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse 
CREATE TABLE sample_geometries(id INTEGER, geometry ST_LINESTRING)
The following SQL statement inserts two rows in the SAMPLE_GEOMETRIES table.
INSERT INTO sample_geometries(id, geometry)
VALUES
 (1,ST_LineString('LINESTRING ZM(0 0 0 0, 10 100 1000 10000)',1)),
 (2,ST_LineString('LINESTRING ZM(10 100 1000 10000, 0 0 0 0)',1))
The following SELECT statement and the corresponding result set shows how to use the ST_PointAtDistance function to find points at a distance of 15 coordinate units from the start of the linestring.
SELECT ID, VARCHAR(ST_AsText(ST_PointAtDistance(geometry, 15)), 50) AS POINTAT 
FROM  sample_geometries

ID          POINTAT                                           
----------- --------------------------------------------------
          1 POINT ZM(1.492556 14.925558 149 1493)             
          2 POINT ZM(8.507444 85.074442 851 8507)             

  2 record(s) selected.