Skip to content

ST_LineInterpolatePoint

Returns a point interpolated along a line.

Usage

geometry ST_LineInterpolatePoint(geom: geometry, fraction: double)
geography ST_LineInterpolatePoint(geog: geography, fraction: double)

Arguments

  • geog (geography): Input geography
  • fraction (double)
  • geom (geometry): Input geometry

Description

Returns a point interpolated along a line. First argument must be a LINESTRING. Second argument is a double between 0 and 1 representing fraction of total linestring length the point has to be located. For geography, the interpolation is computed using spherical interpolation between vertices.

Examples

SELECT ST_LineInterpolatePoint(ST_GeomFromWKT('LINESTRING (0 0, 1 1)'), 0.5);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_lineinterpolatepoint(st_geomfromwkt(Utf8("LINESTRING (0 0, 1 1)")),Float6 │
│                                   4(0.5))…                                   │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POINT(0.5 0.5)                                                               │
└──────────────────────────────────────────────────────────────────────────────┘
SELECT ST_LineInterpolatePoint(ST_GeogFromWKT('LINESTRING (0 0, 1 1)'), 0.5);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_lineinterpolatepoint(st_geogfromwkt(Utf8("LINESTRING (0 0, 1 1)")),Float6 │
│                                   4(0.5))…                                   │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POINT(0.4999619199226218 0.5000190382261059)                                 │
└──────────────────────────────────────────────────────────────────────────────┘