Documentation

Filter geo-temporal data by region

This page documents an earlier version of InfluxDB. InfluxDB v2.6 is the latest stable version. View this page in the v2.6 documentation.

Use the geo.filterRows function to filter geo-temporal data by geographic region:

  1. Define a geographic region
  2. Use strict or non-strict filtering

The following example uses the sample bird migration data and queries data points within 200km of Cairo, Egypt:

import "experimental/geo"

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

Define a geographic region

Many functions in the Geo package filter data based on geographic region. Define a geographic region using one of the the following shapes:

box

Define a box-shaped region by specifying a record containing the following properties:

  • minLat: minimum latitude in decimal degrees (WGS 84) (Float)
  • maxLat: maximum latitude in decimal degrees (WGS 84) (Float)
  • minLon: minimum longitude in decimal degrees (WGS 84) (Float)
  • maxLon: maximum longitude in decimal degrees (WGS 84) (Float)
Example box-shaped region
{
    minLat: 40.51757813,
    maxLat: 40.86914063,
    minLon: -73.65234375,
    maxLon: -72.94921875,
}

circle

Define a circular region by specifying a record containing the following properties:

  • lat: latitude of the circle center in decimal degrees (WGS 84) (Float)
  • lon: longitude of the circle center in decimal degrees (WGS 84) (Float)
  • radius: radius of the circle in kilometers (km) (Float)
Example circular region
{
    lat: 40.69335938,
    lon: -73.30078125,
    radius: 20.0,
}

polygon

Define a polygonal region with a record containing the latitude and longitude for each point in the polygon:

  • points: points that define the custom polygon (Array of records)

    Define each point with a record containing the following properties:

    - **lat**: latitude in decimal degrees (WGS 84) _(Float)_
    - **lon**: longitude in decimal degrees (WGS 84) _(Float)_
    
Example polygonal region
{
    points: [
        {lat: 40.671659, lon: -73.936631},
        {lat: 40.706543, lon: -73.749177},
        {lat: 40.791333, lon: -73.880327},
    ]
}

Strict and non-strict filtering

In most cases, the specified geographic region does not perfectly align with S2 grid cells.

  • Non-strict filtering returns points that may be outside of the specified region but inside S2 grid cells partially covered by the region.
  • Strict filtering returns only points inside the specified region.

Strict filtering is less performant, but more accurate than non-strict filtering.

S2 grid cell
Filter region
Returned point

Strict filtering

Non-strict filtering


Was this page helpful?

Thank you for your feedback!


Set your InfluxDB URL

Linux Package Signing Key Rotation

All signed InfluxData Linux packages have been resigned with an updated key. If using Linux, you may need to update your package configuration to continue to download and verify InfluxData software packages.

For more information, see the Linux Package Signing Key Rotation blog post.

InfluxDB Cloud backed by InfluxDB IOx

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by IOx, this is the correct documentation.

If powered by TSM, see the TSM-based InfluxDB Cloud documentation.

InfluxDB Cloud backed by InfluxDB TSM

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine which enables nearly unlimited series cardinality and SQL query support. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by TSM, this is the correct documentation.

If powered by IOx, see the IOx-based InfluxDB Cloud documentation.

State of the InfluxDB Cloud (IOx) documentation

The new documentation for InfluxDB Cloud backed by InfluxDB IOx is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.