duckdb_spatial icon indicating copy to clipboard operation
duckdb_spatial copied to clipboard

Feature request: ST_LineLocatePoint

Open freevryheid opened this issue 2 months ago • 2 comments

ST_LineLocatePoint to return a float between 0 and 1 representing the location of the closest point on a LineString to the given point, as a fraction of ST_Length length. This will complement ST_LineInterpolatePoint that returns a point interpolated along a line at a fraction of total 2D length.

freevryheid avatar Nov 14 '25 13:11 freevryheid

Hello! This is already implemented,

DuckDB v1.4.1 (Andium) b390a7c376
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D load spatial;
D select st_linelocatepoint('LINESTRING(0 0, 1 1, 2 2)', 'POINT(1 1)');
┌───────────────────────────────────────────────────────────────┐
│ st_linelocatepoint('LINESTRING(0 0, 1 1, 2 2)', 'POINT(1 1)') │
│                            double                             │
├───────────────────────────────────────────────────────────────┤
│                              0.5                              │
└───────────────────────────────────────────────────────────────┘

Maxxen avatar Nov 14 '25 14:11 Maxxen

Thanks - good to know.

freevryheid avatar Nov 17 '25 19:11 freevryheid