Using Grafana Geomap with Signalk InfluxDB Data

79 views
Skip to first unread message

Jürgen Debye

unread,
Jul 16, 2024, 12:36:49 AM7/16/24
to Signal K
Hallo,

I like to use the "Grafana Geomap" with Signalk Data comming from the plugin (Signal K to InfluxDb V2). 

InfluxDb is running very well and in Grafana I can see the Time Sieres diagrams.

The main problem here is to find the right syntax in the flux query for a Grafna GeoMap.

Where can I find an example for this problem?

Best regards 

Jürgen Debye

Ryan Gregg

unread,
Jul 16, 2024, 5:32:04 PM7/16/24
to Signal K
I was successful in doing this using a pivot:


from(bucket: "singalk_aggregated")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "navigation.position")
|> filter(fn: (r) => r["_field"] == "lat" or r["_field"] == "lon")
|> pivot(
rowKey:["_time"],
columnKey: ["_field"],
valueColumn: "_value"
)
|> drop(columns: ["_start", "_stop", "_measurement", "s2_cell_id"])

Now I can see a history of where I've been on the geo map.

Tony Bentley

unread,
Jul 16, 2024, 7:37:13 PM7/16/24
to sig...@googlegroups.com
import "join"

lat = from(bucket: "boat")
|> range(start: -5m)
|> filter(fn: (r) => r["_measurement"] == "navigation.position.latitude")
|> group(columns: ["_time"])
lon = from(bucket: "boat")
|> range(start: -5m)
|> filter(fn: (r) => r["_measurement"] == "navigation.position.longitude")
|> group(columns: ["_time"])
join.time(
left: lat,
right: lon,
as: (l, r) => ({l with latitude: l._value, longitude: r._value}),
)
|> drop(columns: [ "source", "_start","_stop", "_measurement", "_value","_field"])



-- 
You received this message because you are subscribed to the Google Groups "Signal K" group.
To unsubscribe from this group and stop receiving emails from it, send an email to signalk+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/signalk/bac89fa0-87a0-43f6-a152-af521726b622n%40googlegroups.com.

Jürgen Debye

unread,
Jul 23, 2024, 4:42:19 AM7/23/24
to Signal K
Thank you for your big support.  In my case I find the following solution:

from(bucket: "SIGNALK")

  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "navigation.position")
  |> filter(fn: (r) => r["_field"] == "lat" or r["_field"] == "lon")
  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)  

  |> pivot(
    rowKey:["_time"],
    columnKey: ["_field"],
    valueColumn: "_value"
  )
|> drop(columns: ["_start", "_stop", "_measurement", "s2_cell_id"])

The next step will be to create a colored route with the additional information for the Speed over Ground SOG. How can I add this in the flux script?
Reply all
Reply to author
Forward
0 new messages