How can I display the measurement name in the Map?

Hi

I have a bunch of sensors, which are measuring some values like temperature and so on. The data is stored in an InfluxDB where every sensor has its own measurement.

Inside Grafana I’ce defined a dashboars variable ‘sensors’ where you can choose the sensors to display. The setup works fine for time series plots, there also the measurement name is displayed.

The sensors are changing position and every now and then an updated location is provided by the internal GPS module. I want to display the latest position of the selected sensors inside a Geomap Panel (or any other map panel).

I can display the latest position of the sensors, but I cannot display the name of the sensor. How could I achieve that?

The manual Query is: (since I always ant the last entry, independent of the selected time range)

SELECT "dop", "lat", "lon" FROM "autogen"./^$sensors$/ ORDER BY time DESC LIMIT 1

Answer:

{
  "request": {
    "method": "GET",
    "url": "some_url_string",
    "params": {
      "db": "some_database_name",
      "q": "SELECT \"dop\", \"lat\", \"lon\" FROM \"autogen\"./^(sensor_1|sensor_2)$/ ORDER BY time DESC LIMIT 1",
      "epoch": "ms"
    },
    "data": null,
    "precision": "ms",
    "hideFromInspector": false
  },
  "response": {
    "results": [
      {
        "statement_id": 0,
        "series": [
          {
            "name": "sensor_2",
            "columns": [
              "time",
              "dop",
              "lat",
              "lon"
            ],
            "values": [
              [
                1698241950000,
                4.7,
                44.497803,
                6.726331
              ]
            ]
          },
          {
            "name": "sensor_1",
            "columns": [
              "time",
              "dop",
              "lat",
              "lon"
            ],
            "values": [
              [
                1698241878000,
                5.2,
                49.497847,
                2.726377
              ]
            ]
          }
        ]
      }
    ],
    "executedQueryString": "SELECT \"dop\", \"lat\", \"lon\" FROM \"autogen\"./^(sensor_1|sensor_2)$/ ORDER BY time DESC LIMIT 1"
  }
}

Or in other words: How can I select the field “name” from the query answer to be used as the text label of the markers layer of the map?