---
title: geo.ST_LineString() function
description: geo.ST_LineString() converts a series of geographic points into linestring.
url: https://docs.influxdata.com/flux/v0/stdlib/experimental/geo/st_linestring/
estimated_tokens: 1141
product: Flux
version: v0
---

# geo.ST\_LineString() function

-   Flux 0.78.0+
-   View InfluxDB support

`geo.ST_LineString()` is experimental and [subject to change at any time](/flux/v0/stdlib/experimental/#experimental-packages-are-subject-to-change).

`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
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## 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()
```

[](#view-example-input-and-output)

View example input and output

#### Input data

| _time | *id | lon | lat |
| --- | --- | --- | --- |
| 2021-01-01T00:00:00Z | a213b | 39.7515 | 14.01433 |
| 2021-01-02T01:00:00Z | a213b | 38.3527 | 13.9228 |
| 2021-01-03T02:00:00Z | a213b | 36.9978 | 15.08433 |

| _time | *id | lon | lat |
| --- | --- | --- | --- |
| 2021-01-01T00:00:00Z | b546c | 24.0069 | -14.5464 |
| 2021-01-02T01:00:00Z | b546c | 25.1304 | -13.3338 |
| 2021-01-03T02:00:00Z | b546c | 26.7899 | -12.0433 |

#### Output data

| *id | st_linestring |
| --- | --- |
| a213b | 39.7515 14.01433, 38.3527 13.9228, 36.9978 15.08433 |

| *id | st_linestring |
| --- | --- |
| b546c | 24.0069 -14.5464, 25.1304 -13.3338, 26.7899 -12.0433 |

#### Related

-   [Work with geo-temporal data](/influxdb/v2/query-data/flux/geo/)

[geotemporal](/flux/v0/tags/geotemporal/) [transformations](/flux/v0/tags/transformations/) [aggregates](/flux/v0/tags/aggregates/)
