geo.asTracks() function

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

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

Function type: Transformation

import "experimental/geo"

  groupBy: ["id","tid"],
  orderBy: ["_time"]



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

Data type: Array of strings


Column to order results by. Default is ["_time"]

Data type: Array of strings


Group tracks in a box-shaped region
import "experimental/geo"

region = {
  minLat: 40.51757813,
  maxLat: 40.86914063,
  minLon: -73.65234375,
  maxLon: -72.94921875

from(bucket: "example-bucket")
  |> range(start: -1h)
  |> filter(fn: (r) => r._measurement == "example-measurement")
  |> geo.gridFilter(region: region)
  |> geo.toRows(correlationKey: ["_time", "id"])
  |> geo.asTracks()

Function definition

asTracks = (tables=<-, groupBy=["id","tid"], orderBy=["_time"]) =>
    |> group(columns: groupBy)
    |> sort(columns: orderBy)

New! Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: