---
title: geo.toRows() function
description: geo.toRows() pivots fields into columns based on time.
url: https://docs.influxdata.com/flux/v0/stdlib/experimental/geo/torows/
estimated_tokens: 1098
product: Flux
version: v0
---

# geo.toRows() function

-   Flux 0.63.0+
-   View InfluxDB support

`geo.toRows()` is experimental and [subject to change at any time](/flux/v0/stdlib/experimental/#experimental-packages-are-subject-to-change).

`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

```js
(<-tables: stream[A]) => stream[B] where A: Record, B: Record
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### tables

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

## Examples

### Pivot lat and lon fields into columns

```js
import "experimental/geo"

data
    |> geo.toRows()
```

[](#view-example-input-and-output)

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 |

#### Related

-   [Work with geo-temporal data](/influxdb/v2/query-data/flux/geo/)
-   [pivot() function](/flux/v0/stdlib/universe/pivot/)

[transformations](/flux/v0/tags/transformations/) [geotemporal](/flux/v0/tags/geotemporal/)
