Visualize GPS coordinates in Map

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:

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:

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


Have you checked out this sample dashboard?

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

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:

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.

1 Like

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?