Spatial operators
This page describes the available operators to assist with performing spatial calculations. For more information on this type of data, see the geohashes documentation and the spatial functions which have been added to help with filtering and generating data.
#
withinwithin(geohash, ...)
- evaluates if a comma-separated list of geohashes are
equal to are within another geohash.
info
The
within
operator can only be used inLATEST BY
queries and all symbol columns within the query must be indexed.Only geohash literals (
#ezzn5kxb
) are supported as opposed to geohashes passed as strings ('ezzn5kxb'
).
Arguments:
geohash
is a geohash type in text or binary form
Return value:
- evaluates to
true
if geohash values are a prefix or complete match based on the geohashes passed as arguments
Examples:
Given a table with the following contents:
ts | device_id | g1c | g8c |
---|---|---|---|
2021-09-02T14:20:07.721444Z | device_2 | e | ezzn5kxb |
2021-09-02T14:20:08.241489Z | device_1 | u | u33w4r2w |
2021-09-02T14:20:08.241489Z | device_3 | u | u33d8b1b |
The within
operator can be used to filter results by geohash:
This yields the following results:
ts | device_id | g1c | g8c |
---|---|---|---|
2021-09-02T14:20:07.721444Z | device_2 | e | ezzn5kxb |
2021-09-02T14:20:08.241489Z | device_3 | u | u33d8b1b |
Additionally, prefix-like matching can be performed to evaluate if geohashes exist within a larger grid:
ts | device_id | g1c | g8c |
---|---|---|---|
2021-09-02T14:20:08.241489Z | device_1 | u | u33w4r2w |
2021-09-02T14:20:08.241489Z | device_3 | u | u33d8b1b |