Documentation

geo.ST_Intersects() function

The geo.ST_Intersects() function is experimental and subject to change at any time. By using this function, you accept the risks of experimental functions.

The geo.ST_Intersects() function tests if the specified geographic information system (GIS) geometry intersects with the specified region and returns true or false.

Function type: Test

import "experimental/geo"

geo.ST_Intersects(
  region: {lat: 40.7, lon: -73.3, radius: 20.0},
  geometry: {linestring: "39.7515 14.01433, 38.3527 13.9228, 36.9978 15.08433"}
)

// Returns false

Parameters

region

The region to test. Specify record properties for the shape. See Region definitions.

Data type: Record

geometry

The GIS geometry to test. Can be either point or linestring geometry. See GIS geometry definitions.

Data type: Record

Examples

Test if geographic points intersect with a region
import "experimental/geo"

region = {
  minLat: 40.51757813,
  maxLat: 40.86914063,
  minLon: -73.65234375,
  maxLon: -72.94921875
}

data
  |> geo.toRows()
  |> map(fn: (r) => ({
    r with st_within: geo.ST_Intersects(region: box, geometry: {lat: r.lat, lon: r.lon})
  }))

New! Cloud or OSS?

InfluxDB OSS 2.0 release candidate

InfluxDB OSS v2.0.rc includes breaking changes that require a manual upgrade from all alpha and beta versions. For information, see:

Upgrade to InfluxDB OSS v2.0.rc