Documentation

geo.gridFilter() function

geo.gridFilter() is experimental and subject to change at any time.

geo.gridFilter() filters data by a specified geographic region.

The function compares input data to a set of S2 cell ID tokens located in the specified region. Input data must include an s2_cell_id column that is part of the group key.

Note: S2 Grid cells may not perfectly align with the defined region, so results may include data with coordinates outside the region, but inside S2 grid cells partially covered by the region. Use geo.toRows() and geo.strictFilter() after geo.gridFilter() to precisely filter points.

Function type signature
(
    <-tables: stream[{B with s2_cell_id: string}],
    region: A,
    ?level: int,
    ?maxSize: int,
    ?minSize: int,
    ?s2cellIDLevel: int,
    ?units: {distance: string},
) => stream[{B with s2_cell_id: string}] where A: Record
For more information, see Function type signatures.

Parameters

region

(Required) Region containing the desired data points.

Specify record properties for the shape.

minSize

Minimum number of cells that cover the specified region. Default is 24.

maxSize

Maximum number of cells that cover the specified region. Default is -1 (unlimited).

level

S2 cell level of grid cells. Default is -1.

Note: level is mutually exclusive with minSize and maxSize and must be less than or equal to s2cellIDLevel.

s2cellIDLevel

S2 cell level used in the s2_cell_id tag. Default is -1 (detects S2 cell level from the S2 cell ID token).

units

Record that defines the unit of measurement for distance. Default is the geo.units option.

tables

Input data. Default is piped-forward data (<-).

Examples

Filter data to a specified region

import "experimental/geo"

data
    |> geo.gridFilter(region: {lat: 40.69335938, lon: -73.30078125, radius: 20.0})

View example input and output


Was this page helpful?

Thank you for your feedback!


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.