geo.ST_DWithin() function
The geo.ST_DWithin()
function is experimental and subject to change at any time.
By using this function, you accept the risks of experimental functions.
The geo.ST_DWithin()
function tests if the specified region is within a defined
distance from the specified geographic information system (GIS) geometry and
returns true
or false
.
import "experimental/geo"
geo.ST_DWithin(
region: {lat: 40.7, lon: -73.3, radius: 20.0},
geometry: {lon: 39.7515, lat: 15.08433},
distance: 1000.0,
)
// Returns false
Parameters
region
The region to test. Specify record properties for the shape. See Region definitions.
geometry
The GIS geometry to test. Can be either point or linestring geometry. See GIS geometry definitions.
distance
Maximum distance allowed between the region and geometry.
Define distance units with the geo.units
option.
Examples
Test if geographic points are within a distance from 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_DWithin(region: box, geometry: {lat: r.lat, lon: r.lon}, distance: 15.0)}),
)
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, the following resources are available:
InfluxDB Cloud customers can contact InfluxData Support.