ST_LineLocatePoint¶
Returns the location of the closest point on a LineString as a fraction of its total length.
Usage¶
double ST_LineLocatePoint(geogA: geography, geogB: geography)
Arguments¶
- geogA (geography): Input geography
- geogB (geography): Input geography
Description¶
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 or geography. For geography, the fraction is computed based on spherical interpolation between vertices.
Examples¶
SELECT ST_LineLocatePoint(
ST_GeogFromWKT('LINESTRING (0 0, 1 1, 2 2)'),
ST_GeogFromWKT('POINT (1 1)')
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_linelocatepoint(st_geogfromwkt(Utf8("LINESTRING (0 0, 1 1, 2 2)")),st_geo │
│ gfromwkt(Utf8("POINT (1 1)")))… │
╞══════════════════════════════════════════════════════════════════════════════╡
│ 0.5000380781430777 │
└──────────────────────────────────────────────────────────────────────────────┘