Documentation

Group geo-temporal data

Use the geo.groupByArea() to group geo-temporal data by area and geo.asTracks() to group data into tracks or routes.

For example results, use the bird migration sample data to populate the sampleGeoData variable in the queries below.

Group data by area

Use the geo.groupByArea() function to group geo-temporal data points by geographic area. Areas are determined by S2 grid cells

  • Specify a new column to store the unique area identifier for each point with the newColumn parameter.
  • Specify the S2 cell level to use when calculating geographic areas with the level parameter.

The following example uses the sample bird migration data to query data points within 200km of Cairo, Egypt and group them by geographic area:

import "experimental/geo"

sampleGeoData
    |> geo.filterRows(region: {lat: 30.04, lon: 31.23, radius: 200.0})
    |> geo.groupByArea(newColumn: "geoArea", level: 5)
  • Copy
  • Fill window

Group data by track or route

Use geo.asTracks() function to group data points into tracks or routes and order them by time or other columns. Data must contain a unique identifier for each track. For example: id or tid.

  • Specify columns that uniquely identify each track or route with the groupBy parameter.
  • Specify which columns to sort by with the sortBy parameter. Default is ["_time"].

The following example uses the sample bird migration data to query data points within 200km of Cairo, Egypt and group them into routes unique to each bird:

import "experimental/geo"

sampleGeoData
    |> geo.filterRows(region: {lat: 30.04, lon: 31.23, radius: 200.0})
    |> geo.asTracks(groupBy: ["id"], orderBy: ["_time"])
  • Copy
  • Fill window

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB 3 Core and Enterprise are now in Beta

InfluxDB 3 Core and Enterprise are now available for beta testing, available under MIT or Apache 2 license.

InfluxDB 3 Core is a high-speed, recent-data engine that collects and processes data in real-time, while persisting it to local disk or object storage. InfluxDB 3 Enterprise is a commercial product that builds on Core’s foundation, adding high availability, read replicas, enhanced security, and data compaction for faster queries. A free tier of InfluxDB 3 Enterprise will also be available for at-home, non-commercial use for hobbyists to get the full historical time series database set of capabilities.

For more information, check out:

InfluxDB Cloud powered by TSM