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*

  1. import "experimental/geo"
  2. geo.asTracks(
  3. groupBy: ["id","tid"],
  4. orderBy: ["_time"]
  5. )

Parameters

groupBy

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

*Data type: Array of strings*

orderBy

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

*Data type: Array of strings*

Examples

Group tracks in a box-shaped region
  1. import "experimental/geo"
  2. region = {
  3. minLat: 40.51757813,
  4. maxLat: 40.86914063,
  5. minLon: -73.65234375,
  6. maxLon: -72.94921875
  7. }
  8. from(bucket: "example-bucket")
  9. |> range(start: -1h)
  10. |> filter(fn: (r) => r._measurement == "example-measurement")
  11. |> geo.gridFilter(region: region)
  12. |> geo.toRows(correlationKey: ["_time", "id"])
  13. |> geo.asTracks()

Function definition

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

Related articles

functions geo