---
title: geo.asTracks() function
description: geo.asTracks() groups rows into tracks (sequential, related data points).
url: https://docs.influxdata.com/flux/v0/stdlib/experimental/geo/astracks/
estimated_tokens: 1942
product: Flux
version: v0
---

# geo.asTracks() function

-   Flux 0.63.0+
-   View InfluxDB support

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

`geo.asTracks()` groups rows into tracks (sequential, related data points).

##### Function type signature

```js
(<-tables: stream[A], ?groupBy: [string], ?orderBy: [string]) => stream[A] where A: Record
```

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

## Parameters

### groupBy

Columns to group by. These columns should uniquely identify each track. Default is `["id","tid"]`.

### orderBy

Columns to order results by. Default is `["_time"]`.

Sort precedence is determined by list order (left to right).

### tables

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

## Examples

-   [Group geotemporal data into tracks](#group-geotemporal-data-into-tracks)
-   [Group geotemporal data into tracks and sort by specified columns](#group-geotemporal-data-into-tracks-and-sort-by-specified-columns)

### Group geotemporal data into tracks

```js
import "experimental/geo"

data
    |> geo.asTracks()
```

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

View example input and output

#### Input data

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

#### Output data

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

### Group geotemporal data into tracks and sort by specified columns

```js
import "experimental/geo"

data
    |> geo.asTracks(orderBy: ["lat", "lon"])
```

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

View example input and output

#### Input data

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

#### Output data

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

#### Related

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

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