docs-v2/content/flux/v0/stdlib/experimental/geo/torows.md

2.6 KiB

title description menu weight flux/v0/tags
geo.toRows() function `geo.toRows()` pivots fields into columns based on time.
flux_v0_ref
name parent identifier
geo.toRows experimental/geo experimental/geo/toRows
201
transformations
geotemporal

geo.toRows() pivots fields into columns based on time.

Latitude and longitude should be stored as fields in InfluxDB. Because most geo package transformation functions require rows to have lat and lon columns, lat and lot fields must be pivoted into columns.

Function type signature
(<-tables: stream[A]) => stream[B] where A: Record, B: Record

{{% caption %}} For more information, see Function type signatures. {{% /caption %}}

Parameters

tables

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

Examples

Pivot lat and lon fields into columns

import "experimental/geo"

data
    |> geo.toRows()

{{< expand-wrapper >}} {{% expand "View example input and output" %}}

Input data

_time *id *_field _value
2021-01-01T00:00:00Z a213b lat 14.01433
2021-01-02T01:00:00Z a213b lat 13.9228
2021-01-03T02:00:00Z a213b lat 15.08433
_time *id *_field _value
2021-01-01T00:00:00Z a213b lon 39.7515
2021-01-02T01:00:00Z a213b lon 38.3527
2021-01-03T02:00:00Z a213b lon 36.9978

Output data

_time *id lat lon
2021-01-01T00:00:00Z a213b 14.01433 39.7515
2021-01-02T01:00:00Z a213b 13.9228 38.3527
2021-01-03T02:00:00Z a213b 15.08433 36.9978

{{% /expand %}} {{< /expand-wrapper >}}