---
title: Work with geo-temporal data
description: Use the Flux Geo package to filter geo-temporal data and group by geographic location or track.
url: https://docs.influxdata.com/influxdb/v2/query-data/flux/geo/
estimated_tokens: 2000
product: InfluxDB OSS v2
version: v2
---

# Work with geo-temporal data

This page documents an earlier version of InfluxDB OSS. [InfluxDB 3 Core](/influxdb3/core/) is the latest stable version.

#### API token hashing is enabled by default in InfluxDB OSS 2.9.0

Stronger token security: tokens are stored as hashes on disk, so a copy of the database file doesn’t expose usable tokens. Existing tokens are hashed on first startup and the original strings can’t be recovered afterward — **capture any plaintext tokens you still need before you upgrade**.

For more information, see [Token hashing](/influxdb/v2/admin/tokens/#token-hashing).

Use the [Flux Geo package](/flux/v0/stdlib/experimental/geo) to filter geo-temporal data and group by geographic location or track.

The Geo package is experimental and subject to change at any time. By using it, you agree to the [risks of experimental functions](/flux/v0/stdlib/experimental/to/#experimental-functions-are-subject-to-change).

**To work with geo-temporal data:**

1. Import the `experimental/geo` package.
    
    ```js
    import "experimental/geo"
    ```
    
2. Load geo-temporal data. *See below for [sample geo-temporal data](#sample-data).*
    
3. Do one or more of the following:
    
    -   [Shape data to work with the Geo package](#shape-data-to-work-with-the-geo-package)
    -   [Filter data by region](#filter-geo-temporal-data-by-region) (using strict or non-strict filters)
    -   [Group data by area or by track](#group-geo-temporal-data)

### [Shape data to work with the Geo package](/influxdb/v2/query-data/flux/geo/shape-geo-data/)

Functions in the Flux Geo package require **lat** and **lon** fields and an **s2\_cell\_id** tag. Rename latitude and longitude fields and generate S2 cell ID tokens.

```js
import "experimental/geo"

sampleGeoData
    |> geo.shapeData(latField: "latitude", lonField: "longitude", level: 10)
```

### [Filter geo-temporal data by region](/influxdb/v2/query-data/flux/geo/filter-by-region/)

Use the `geo.filterRows` function to filter geo-temporal data by box-shaped, circular, or polygonal geographic regions.

```js
import "experimental/geo"

sampleGeoData
    |> geo.filterRows(region: {lat: 30.04, lon: 31.23, radius: 200.0}, strict: true)
```

### [Group geo-temporal data](/influxdb/v2/query-data/flux/geo/group-geo-data/)

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

```js
import "experimental/geo"

sampleGeoData
    |> geo.groupByArea(newColumn: "geoArea", level: 5)
    |> geo.asTracks(groupBy: ["id"],sortBy: ["_time"])
```

## Sample data

Many of the examples in this section use a `sampleGeoData` variable that represents a sample set of geo-temporal data. The [Bird Migration Sample Data](/influxdb/v2/reference/sample-data/#bird-migration-sample-data) provides sample geo-temporal data that meets the [requirements of the Flux Geo package](/flux/v0/stdlib/experimental/geo/#geo-schema-requirements).

### Load bird migration sample data

Use the [`sample.data()` function](/flux/v0/stdlib/influxdata/influxdb/sample/data/) to load the sample bird migration data:

```js
import "influxdata/influxdb/sample"

sampleGeoData = sample.data(set: "birdMigration")
```

`sample.data()` downloads sample data each time you execute the query **(~1.3 MB)**. If bandwidth is a concern, use the [`to()` function](/flux/v0/stdlib/influxdata/influxdb/to/) to write the data to a bucket, and then query the bucket with [`from()`](/flux/v0/stdlib/influxdata/influxdb/from/).
