All Products
Search
Document Center

PolarDB:ST_LineLocatePoint

Last Updated:Oct 19, 2023

This topic describes the ST_LineLocatePoint function. This function returns a floating-point number within the range of 0 to 1 to represent the location of the closest point in a LineString object to a point object in contrast to the total length of the LineString object.

Syntax

float8  ST_LineLocatePoint(geometry  aLinestring , geometry  aPoint);
float8  ST_LineLocatePoint(geography  aLinestring , geography  aPoint);

Parameters

Parameter

Description

aLinestring

The LineString object.

aPoint

The point object.

Description

This function can be used to estimate the number of addresses.

Examples

SELECT ST_LineLocatePoint('LINESTRING(0 0,0 2)'::geometry, 'POINT(1 1)'::geometry);
 st_linelocatepoint
--------------------
                0.5
(1 row)

-- geography
SELECT ST_LineLocatePoint('LINESTRING(0 0,0 2)'::geography, 'POINT(1 1)'::geography);
 st_linelocatepoint 
--------------------
 0.5000746195163556
(1 row)