content/flux/v0/stdlib/experimental/geo/torows.md
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.
(<-tables: stream[A]) => stream[B] where A: Record, B: Record
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
Input data. Default is piped-forward data (<-).
import "experimental/geo"
data
|> geo.toRows()
{{< expand-wrapper >}} {{% expand "View example input and output" %}}
| _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 |
| _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 >}}