content/flux/v0/stdlib/experimental/geo/astracks.md
geo.asTracks() groups rows into tracks (sequential, related data points).
(<-tables: stream[A], ?groupBy: [string], ?orderBy: [string]) => stream[A] where A: Record
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
Columns to group by. These columns should uniquely identify each track.
Default is ["id","tid"].
Columns to order results by. Default is ["_time"].
Sort precedence is determined by list order (left to right).
Input data. Default is piped-forward data (<-).
import "experimental/geo"
data
|> geo.asTracks()
{{< expand-wrapper >}} {{% expand "View example input and output" %}}
| _time | id | lat | lon |
|---|---|---|---|
| 2021-01-01T00:00:00Z | a213b | 14.01433 | -14.5464 |
| 2021-01-02T01:00:00Z | a213b | 13.9228 | -13.3338 |
| 2021-01-03T02:00:00Z | a213b | 15.08433 | -12.0433 |
| 2021-01-01T00:00:00Z | b546c | 14.01433 | 39.7515 |
| 2021-01-02T01:00:00Z | b546c | 13.9228 | 38.3527 |
| 2021-01-03T02:00:00Z | b546c | 15.08433 | 36.9978 |
| _time | *id | lat | lon |
|---|---|---|---|
| 2021-01-01T00:00:00Z | a213b | 14.01433 | -14.5464 |
| 2021-01-02T01:00:00Z | a213b | 13.9228 | -13.3338 |
| 2021-01-03T02:00:00Z | a213b | 15.08433 | -12.0433 |
| _time | *id | lat | lon |
|---|---|---|---|
| 2021-01-01T00:00:00Z | b546c | 14.01433 | 39.7515 |
| 2021-01-02T01:00:00Z | b546c | 13.9228 | 38.3527 |
| 2021-01-03T02:00:00Z | b546c | 15.08433 | 36.9978 |
{{% /expand %}} {{< /expand-wrapper >}}
import "experimental/geo"
data
|> geo.asTracks(orderBy: ["lat", "lon"])
{{< expand-wrapper >}} {{% expand "View example input and output" %}}
| _time | id | lat | lon |
|---|---|---|---|
| 2021-01-01T00:00:00Z | a213b | 14.01433 | -14.5464 |
| 2021-01-02T01:00:00Z | a213b | 13.9228 | -13.3338 |
| 2021-01-03T02:00:00Z | a213b | 15.08433 | -12.0433 |
| 2021-01-01T00:00:00Z | b546c | 14.01433 | 39.7515 |
| 2021-01-02T01:00:00Z | b546c | 13.9228 | 38.3527 |
| 2021-01-03T02:00:00Z | b546c | 15.08433 | 36.9978 |
| _time | *id | lat | lon |
|---|---|---|---|
| 2021-01-02T01:00:00Z | a213b | 13.9228 | -13.3338 |
| 2021-01-01T00:00:00Z | a213b | 14.01433 | -14.5464 |
| 2021-01-03T02:00:00Z | a213b | 15.08433 | -12.0433 |
| _time | *id | lat | lon |
|---|---|---|---|
| 2021-01-02T01:00:00Z | b546c | 13.9228 | 38.3527 |
| 2021-01-01T00:00:00Z | b546c | 14.01433 | 39.7515 |
| 2021-01-03T02:00:00Z | b546c | 15.08433 | 36.9978 |
{{% /expand %}} {{< /expand-wrapper >}}