# Visualize GPS coordinates in Map

**URL:** <https://community.grafana.com/t/visualize-gps-coordinates-in-map/64305>\
**Category:** InfluxDB\
**Tags:** geomap-panel, templating, edge\
**Created:** [April 20, 2022, 7:20am UTC](https://community.grafana.com/t/visualize-gps-coordinates-in-map/64305 "2022-04-20T07:20:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthias007](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@matthias007](https://community.grafana.com/u/matthias007)\
**Post date:** [April 20, 2022, 7:20am UTC](https://community.grafana.com/t/visualize-gps-coordinates-in-map/64305/1 "2022-04-20T07:20:14Z")

</div>

Good morning,

I’m quite new in Grafana. I’m using Grafana (v8.4.6) together with an influxdb, which is feeded from Openhab3. I want to visualize the following GPS coordinates (which are yet still all the same) in a map:

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/9/2/92b6d4f3eea61615a4cd9db14f3785a0c9b0547a.png)

I was already playing around a bit with the Geomap visualization, but unfortunately I do not manage. This is how I set the data layer section:

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/b/c/bc52e48c3627887a3ea16da4e9a4f96c21a0a008.png)

Maybe one of you could guide me into the the right direction - mayn thanks!

Matthias

---

<div class="post-metadata">

**Author:** ![anon70503803](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@anon70503803](https://community.grafana.com/u/anon70503803)\
**Post date:** [April 27, 2022, 5:27pm UTC](https://community.grafana.com/t/visualize-gps-coordinates-in-map/64305/2 "2022-04-27T17:27:50Z")

</div>

Have you checked out this sample dashboard?

let me ask around and see if we have any more samples…

[https://play.grafana.org/d/f6aHs\_0nz/new-dashboard-geomap?orgId=1](https://play.grafana.org/d/f6aHs_0nz/new-dashboard-geomap?orgId=1)

---

<div class="post-metadata">

**Author:** ![wolfgang1966](https://avatars.discourse-cdn.com/v4/letter/w/ee7513/32.png) [@wolfgang1966](https://community.grafana.com/u/wolfgang1966)\
**Post date:** [March 9, 2023, 3:10pm UTC](https://community.grafana.com/t/visualize-gps-coordinates-in-map/64305/3 "2023-03-09T15:10:01Z")

</div>

Hi @matthias007 , just stumbled over your question as I tried to solve the same problem. Finally I found the following solution.

Grafana needs the fields “lat” and “lon” in the result to use them as geodata. With influxdb version 2 and flux queries, the solution is then to add a mapping to the flux query. This works for me:

```auto
import "strings"

from(bucket: "openhab/autogen")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "Flash_Location")
  |> map(fn: (r) => ({r with lat: float(v: strings.split(v: r._value, t:",")[0]) , lon: float(v: strings.split(v: r._value, t:",")[1]) }))
  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: true)
  |> fill(usePrevious: true)

```

Check out whether it works for you also.

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [March 9, 2023, 4:19pm UTC](https://community.grafana.com/t/visualize-gps-coordinates-in-map/64305/4 "2023-03-09T16:19:05Z")

</div>

Wondering why you are doing the mapping and aggregation? Does the lon, lat data have something that needs to be cleaned up and converted to float?
