Documentation

geo.ST_LineString() function

The geo.ST_LineString() function is experimental and subject to change at any time. By using this function, you accept the risks of experimental functions.

The geo.ST_LineString() function converts a series of geographic points into linestring. Group data into meaningful, ordered paths to before converting to linestring. Rows in each table must have lat and lon columns. Output tables contain a single row with a st_linestring column containing the resulting linestring. geo.ST_LineString() is an aggregate function.

import "experimental/geo"

geo.ST_LineString()

Examples

Convert a series of geographic points into linestring

Input data
_time id lon lat
2020-01-01T00:00:00Z a213b 39.7515 14.01433
2020-01-02T00:00:00Z a213b 38.3527 13.9228
2020-01-03T00:00:00Z a213b 36.9978 15.08433
import "experimental/geo"

data
    |> geo.ST_LineString()
Output data
id st_linestring
a213b 39.7515 14.01433, 38.3527 13.9228, 36.9978 15.08433

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.