Unable to display Latitude/Longitude in Grafana Geomap panel for Flux data
Specifications
- InfluxDB Version: Cloud
Code sample to reproduce problem
I tried working with the Geomap panel in Grafana. My data is coming from an InfluxDB Cloud 2.0 database with Flux as query language. The query I'm running looks as follows:
from(bucket: v.defaultBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "1F4F8F26")
|> filter(fn: (r) => r["_field"] == "Latitude" or r["_field"] == "Longitude")
|> aggregateWindow(every: v.windowPeriod, fn: median)
|> yield(name: "median")
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
Expected behavior
Ideally, it would be possible to run below 'simpler' query without the pivot part:
from(bucket: v.defaultBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "1F4F8F26")
|> filter(fn: (r) => r["_field"] == "Latitude" or r["_field"] == "Longitude")
|> aggregateWindow(every: v.windowPeriod, fn: median)
|> yield(name: "median")
Then, in the Geomap panel, selecting Location mode as Coords should allow me to manually set Latitude and Longitude as I attempted in 1) above. This is how the TrackMap panel works and it's very simple and intuitive.
I realize this is not directly linked to the Python API, but hoping somebody has inputs on how to use InfluxDB data for the Grafana Geomap panel.
Actual behavior
In a Table context, this yields below result (it produces 3 outputs, one with Time, Langitude, one with Time, Longitude and one with Time, Langitude, Longitude as per below selected output):

However, even with the pivot output I struggle to get the points to display in the Geomap panel.
-
I have tried to display the data using the
Markersandroutelayers (alpha version of Grafana). Below is the result if I try to leave theDatafield unset and select the pre-pivoted Latitude/Longitude signals. It does not work:
-
I also tried with the outputs from the Pivot, which is what I used to produce the output in the table above. Here, I first set the
Datafield to be equal to the pivot output (Time, Latitude, Longitude) before then selecting manually the signals coming from that pivot output. This also does not seem to work as per below:
To make it even stranger, it appears that the 2nd version above "sometimes works" for just a moment, until e.g. a refresh causes the markers to disappear again. It seems to me that there is some form of problem with the combination of Flux queries and the Geomap panel.
Additional info
No response