Skip to content
🎉 Apache Sedona 1.8.1 is now available! Check out the new features and improvements.

ST_LineLocatePoint

Introduction: Returns a double between 0 and 1, representing the location of the closest point on the LineString as a fraction of its total length. The first argument must be a LINESTRING, and the second argument is a POINT geometry.

Format: ST_LineLocatePoint(linestring: Geometry, point: Geometry)

SQL Example:

SELECT ST_LineLocatePoint(ST_GeomFromWKT('LINESTRING(0 0, 1 1, 2 2)'), ST_GeomFromWKT('POINT(0 2)'))

Output:

0.5