Shape data to work with the Geo package |
Functions in the Flux Geo package require **lat** and **lon** fields and an **s2_cell_id** tag. Rename latitude and longitude fields and generate S2 cell ID tokens.
|
influxdb_cloud |
name |
parent |
Shape geo-temporal data |
Geo-temporal data |
|
|
301 |
/flux/v0/stdlib/experimental/geo/ |
/flux/v0/stdlib/experimental/geo/shapedata/ |
/flux/v0/stdlib/experimental/geo/s2cellidtoken/ |
|
```js
import "experimental/geo"
sampleGeoData
|> map(
fn: (r) => ({r with
_field: if r._field == "latitude" then
"lat"
else if r._field == "longitude" then
"lon"
else
r._field,
}),
)
|> map(fn: (r) => ({r with s2_cell_id: geo.s2CellIDToken(point: {lon: r.lon, lat: r.lat}, level: 10)}))
```
|