How to convert coordinatestring for geomap

Hello, from my car i get the location in one string in this format “54.36988003,13.024355”. i read out the data with openHAB 4.1.2 and store the data in an influxdb 2.7.6. Grafana i dont see the version, but the last update i run at 2024.04.11. I tryed find a way to convert with the grafana AI but every way he told me ends with errorcodes. Can somebody tell me how i can convert that string in an dataformat for the geomap?

have you tried to split the string in your query?

strings.split()

i found the soloution… yesterday i forgot to import “Strings”… now it works

import "strings"

from(bucket: "openHAB_db")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "MyCar_Ort")
  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
  |> map(fn: (r) => ({
      lat: strings.split(v: r["_value"], t: ",")[0],
      lon: strings.split(v: r["_value"], t: ",")[1]
  }))
1 Like