Query Longitude and Latitude for the geomap-panel

First of all i am running a grafana cloud instance (version 8.5.2.) on my linux machine.

  • I want to implement a geomap-panel which shows me the location of my sensors and also translates the values which are measured into the size of the symbols.

  • Currently i have a influx database which i am querying via the flux syntax. My bucket structure is as followed:

  1. "example-bucket":
  2. _measurement : list of sensors
  3. _tags =(“Longitude”, “Latitude”): these two tags give me my geographical locations in a float format
  4. _field =(“measurementofthesensor”): this field shows the measurement of the specific sensor (f.ex. humidity => 30 %)
  • Right now if i click on the normal table view i dont even generate a table where these values are seperated. I only get my timestamp and a big string with all the tags and the according measurementofthesensor.

  • My question now would be how to query my tags and field so that i can select the values inside my worldmap-panel?

  • A question overall would be if you should query the long- and latitude as a tag or a field and the benefits of it ?

sensorname,timeline,humidity,lat,lng
New York,2022-06-22 18:53:06.387,34.4576,40.6943,-73.9249
Los Angeles,2022-06-22 18:52:52.860,10.4544,34.1141,-118.4068
Chicago,2022-06-22 18:52:32.863,14.6432,41.8375,-87.6866
Miami,2022-06-22 18:52:47.520,15.824,25.7840,-80.2101

from(bucket: "sensors")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "sensor_readings")
  |> filter(fn: (r) => r._field == "humidity" or r._field == "sensorname" or r._field == "longitude" or r._field == "latitude")  
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> group()  
  |> drop(columns: ["_start", "_stop", "_time","_measurement"])

image

1 Like