# Error when using experimental/geo package

**URL:** <https://community.influxdata.com/t/error-when-using-experimental-geo-package/19707>\
**Category:** Fluxlang\
**Tags:** query, flux\
**Created:** [May 3, 2021, 1:11pm UTC](https://community.influxdata.com/t/error-when-using-experimental-geo-package/19707 "2021-05-03T13:11:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eloparco](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@eloparco](https://community.influxdata.com/u/eloparco)\
**Post date:** [May 3, 2021, 1:11pm UTC](https://community.influxdata.com/t/error-when-using-experimental-geo-package/19707/1 "2021-05-03T13:11:36Z")

</div>

Hello,  
I just started playing around with geolocation data 🙂  
I have coordinates and I want to group points into areas using `geo.groupByArea()` function but I get the following error:

```auto
error calling function "groupByArea" @14:8-14:55: error calling function "_detectLevel" @geo.flux|195:12-195:26: error calling function "tableFind" @geo.flux|82:10-82:55: no table found

```

Here a minimal example to reproduce the error:

```auto
import "array"
import "experimental/geo"

array.from(rows: [
    {lat: 53.4808, lon: 2.2426},
    {lat: 51.5074, lon: 0.1278}
])
    |> map(fn: (r) => ({ r with s2_cell_id: 
        geo.s2CellIDToken(
            point: {lat: r.lat, lon: r.lon},
            level: 10
        )
    }))
    |> geo.groupByArea(newColumn: "geoArea", level: 5)

```

I tried a few workarounds but I’m still unable to make it work.  
Thanks for the help

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [May 3, 2021, 3:33pm UTC](https://community.influxdata.com/t/error-when-using-experimental-geo-package/19707/2 "2021-05-03T15:33:11Z")

</div>

@eloparco What version of InfluxDB / Flux are you using?

---

<div class="post-metadata">

**Author:** ![eloparco](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@eloparco](https://community.influxdata.com/u/eloparco)\
**Post date:** [May 3, 2021, 3:37pm UTC](https://community.influxdata.com/t/error-when-using-experimental-geo-package/19707/3 "2021-05-03T15:37:00Z")

</div>

Sorry I forgot, Flux version `v0.104.0`.

---

<div class="post-metadata">

**Author:** ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)\
**Post date:** [May 3, 2021, 3:42pm UTC](https://community.influxdata.com/t/error-when-using-experimental-geo-package/19707/4 "2021-05-03T15:42:25Z")

</div>

Looking at the [`_detectLevel()` function source code](https://github.com/influxdata/flux/blob/master/stdlib/experimental/geo/geo.flux#L78-L90) in the Geo package, it requires the `s2_cell_id` column to be in the group key (data needs to be grouped by `s2_cell_id`). Try the following:

```plaintext
import "array"
import "experimental/geo"

array.from(rows: [
    {lat: 53.4808, lon: 2.2426},
    {lat: 51.5074, lon: 0.1278}
])
    |> map(fn: (r) => ({ r with s2_cell_id: 
        geo.s2CellIDToken(
            point: {lat: r.lat, lon: r.lon},
            level: 10
        )
    }))
    |> group(columns: ["s2_cell_id"])
    |> geo.groupByArea(newColumn: "geoArea", level: 5)

```

---

<div class="post-metadata">

**Author:** ![eloparco](https://avatars.discourse-cdn.com/v4/letter/e/919ad9/32.png) [@eloparco](https://community.influxdata.com/u/eloparco)\
**Post date:** [May 4, 2021, 1:44pm UTC](https://community.influxdata.com/t/error-when-using-experimental-geo-package/19707/5 "2021-05-04T13:44:02Z")

</div>

Awesome, that was the solution. Thanks!
