Back to Influxdb

geo.ST_LineString() function

content/flux/v0/stdlib/experimental/geo/st_linestring.md

latest2.5 KB
Original Source
<!------------------------------------------------------------------------------ IMPORTANT: This page was generated from comments in the Flux source code. Any edits made directly to this page will be overwritten the next time the documentation is generated. To make updates to this documentation, update the function comments above the function definition in the Flux source code: https://github.com/influxdata/flux/blob/master/stdlib/experimental/geo/geo.flux#L356-L370 Contributing to Flux: https://github.com/influxdata/flux#contributing Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md ------------------------------------------------------------------------------->

geo.ST_LineString() 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.

Function type signature
js
(<-tables: stream[{A with lon: C, lat: B}]) => stream[D] where D: Record

{{% caption %}} For more information, see Function type signatures. {{% /caption %}}

Parameters

tables

Input data. Default is piped-forward data (<-).

Examples

Convert a series of geographic points into linestring

js
import "experimental/geo"

data
    |> geo.ST_LineString()

{{< expand-wrapper >}} {{% expand "View example input and output" %}}

Input data

_time*idlonlat
2021-01-01T00:00:00Za213b39.751514.01433
2021-01-02T01:00:00Za213b38.352713.9228
2021-01-03T02:00:00Za213b36.997815.08433
_time*idlonlat
2021-01-01T00:00:00Zb546c24.0069-14.5464
2021-01-02T01:00:00Zb546c25.1304-13.3338
2021-01-03T02:00:00Zb546c26.7899-12.0433

Output data

*idst_linestring
a213b39.7515 14.01433, 38.3527 13.9228, 36.9978 15.08433
*idst_linestring
b546c24.0069 -14.5464, 25.1304 -13.3338, 26.7899 -12.0433

{{% /expand %}} {{< /expand-wrapper >}}