Geomap panel not working for me

  • What Grafana version and what operating system are you using?
    8.4.1

  • What are you trying to achieve?
    show location of a device on geomap-panel

  • How are you trying to achieve it?
    from a gps-device i store with node-red latitude and longitude vales into two fields of a influxdb database. in grafana i setup a dashboard with geomap-panel and defiened two querys, one for the latitude and one for the longitude. configured the panel to use coordinates. see config at the end.

  • What happened?
    no data point on the map

  • What did you expect to happen?
    a cross-mark at the location of latitude and longitude

  • Can you copy/paste the configuration(s) that you are having problems with?
    yes, see below dashboard-json

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    no

  • Did you follow any online instructions? If so, what is the URL?
    tried to use the geomap-panel documentation site unfortunately without success

Thanks for your support

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 11,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "influxdb",
        "uid": "s8Go0hRRz"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "decimals": 1,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 16,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "basemap": {
          "config": {},
          "name": "Layer 0",
          "type": "osm-standard"
        },
        "controls": {
          "mouseWheelZoom": true,
          "showAttribution": true,
          "showDebug": false,
          "showScale": true,
          "showZoom": true
        },
        "layers": [
          {
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "dark-red"
                },
                "opacity": 0.4,
                "rotation": {
                  "fixed": 0,
                  "max": 360,
                  "min": -360,
                  "mode": "mod"
                },
                "size": {
                  "fixed": 5,
                  "max": 15,
                  "min": 2
                },
                "symbol": {
                  "fixed": "img/icons/marker/cross.svg",
                  "mode": "fixed"
                },
                "text": {
                  "field": "Value",
                  "fixed": "",
                  "mode": "field"
                },
                "textConfig": {
                  "fontSize": 12,
                  "offsetX": 0,
                  "offsetY": 0,
                  "textAlign": "center",
                  "textBaseline": "middle"
                }
              }
            },
            "location": {
              "latitude": "latitude",
              "longitude": "longitude",
              "mode": "coords"
            },
            "name": "Layer 1",
            "tooltip": true,
            "type": "markers"
          }
        ],
        "view": {
          "id": "europe",
          "lat": 46,
          "lon": 14,
          "zoom": 4
        }
      },
      "pluginVersion": "8.4.1",
      "targets": [
        {
          "alias": "latitude",
          "datasource": {
            "type": "influxdb",
            "uid": "s8Go0hRRz"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "standort",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT * FROM \"trailer\" WHERE $timeFilter GROUP BY time($__interval) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "lat"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        },
        {
          "alias": "longitude",
          "datasource": {
            "type": "influxdb",
            "uid": "s8Go0hRRz"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "standort",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT * FROM \"trailer\" WHERE $timeFilter GROUP BY time($__interval) fill(null)",
          "rawQuery": false,
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "lon"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        }
      ],
      "title": "Trailer Standort",
      "type": "geomap"
    }
  ],
  "schemaVersion": 35,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Test_Geomap_Plugin",
  "uid": "F0-49pRgk",
  "version": 12,
  "weekStart": ""
}

I solved the problem for me after I found the correct Influx query for the coordinates. So the query should look like:

For the Layer use ‘markers’ and location coordinates with alias latitude for the latitude field and the alias longitude for the longitude field.
After this changes, I see the cross marker at the right location on the map.

2 Likes

Hi !

I am encountering the exact same problem ! Could you (or someone else) describe and explain how to get the two different fields “lat” and “long” in the SELECT part of the query ?

Here is what I got, which is not good…
Geomap

and I thus could not select any Data
Geomap2

Please provide sample of your data as inline csv

latitude,longitude
10.3,-39.00

etc or use flux query language

@yosiasz thanks a lot for your kind help !
I will have a close look to this, hope it will work !

1 Like

@yosiasz I tried to provide the string (latitude,longitude) to Grafana but I couldn’t success since all the structure (MQTT broker, Telegraf, InfluxDB,Grafana) is configurated for float.

I did not find any clear tutorial on flux query language, and since I am starting from scratch in IoT, could you be more specific or provide an example of flux query language ?

For now I got long and lat in float from the MQTT broker (see figure below)
Geomap3

Thanks a lot for your help !

Still waiting for you to provide sample data from influx as csv

We cant see what your influxdb data looks like so if you dont provide that data would be impossible to help you. Help us help you :wink:

Oh sorry I did no get it. I exported longitude and latitude from Influxdb in csv (see below). Is that wht you asked for ?
Sorry again if it is not, I am really starting from scratch (it tooks me 2 hours to find out how to export data in .csv ^^)

name,time,host,topic,value
mqtt_consumer_float,1662507929695650760,vps-362a4be9,GPS/Latitude,43.5785
mqtt_consumer_float,1662507940992628730,vps-362a4be9,GPS/Longitude,1.44712
mqtt_consumer_float,1662508438504964767,vps-362a4be9,GPS/Latitude,43.5784
mqtt_consumer_float,1662508449814560959,vps-362a4be9,GPS/Longitude,1.44725
mqtt_consumer_float,1662508934276570198,vps-362a4be9,GPS/Latitude,43.5786
mqtt_consumer_float,1662508945575239202,vps-362a4be9,GPS/Longitude,1.44746
mqtt_consumer_float,1662509138695504963,vps-362a4be9,GPS/Latitude,43.5787
mqtt_consumer_float,1662509149983999501,vps-362a4be9,GPS/Longitude,1.44708
mqtt_consumer_float,1662509655889258385,vps-362a4be9,GPS/Latitude,43.5787
mqtt_consumer_float,1662509667189381512,vps-362a4be9,GPS/Longitude,1.44702
mqtt_consumer_float,1662509895038356864,vps-362a4be9,GPS/Latitude,43.5789
mqtt_consumer_float,1662509906337284717,vps-362a4be9,GPS/Longitude,1.44702
mqtt_consumer_float,1662510314720799696,vps-362a4be9,GPS/Latitude,43.5782
mqtt_consumer_float,1662510326025024505,vps-362a4be9,GPS/Longitude,1.44731

Geomap4

1 Like

Any idea why is the data saved as follow: > GPS/Longitude,1.44731

One can get around this via regex but would be better to solve this at the root.

This notation is linked with the MQTT broker, would it be better as > longitude, 1.44731 ?
In other words, what is the easiest notation to work with Geomap ?

1 Like

no it’s cool. Ok so I see duplicate rows but different timestamps, the device is stationary it seems like, do you really need all of these rows. I think it might be a bug in geomap when there are multiple identical lon/lat data it does not render. because that same data with just one row shows on the map

Also you might want to save your data like following

city,growth,latitude,longitude,population,rank,state
New York,4.8,40.7127837,-74.0059413,8405837,1,New York
Los Angeles,4.8,34.0522342,-118.2436849,3884307,2,California
Chicago,-6.1,41.8781136,-87.6297982,2718782,3,Illinois
Houston,11.0,29.7604267,-95.3698028,2195914,4,Texas
Philadelphia,2.6,39.9525839,-75.1652215,1553165,5,Pennsylvania
Phoenix,14.0,33.4483771,-112.0740373,1513367,6,Arizona

Can you show us how you are writing your data to influxdb?

Not sure how in flux query you can change

topic,value
GPS/Latitude,43.5785
GPS/Longitude,1.44712

to

Latitude,Longitude
43.5785,1.44712

1 Like

Thanks for the help !
We are in the development phase so you are right, the device is stationnary (later it will be integrated to an airborne platform).

Regarding your question abour InfluxDB, the data acquired by the device are sent as float to InfluxDB through Telegraf (I then plot them directly with Grafana from InfluxDB).

The best way seems to be the conversion of the format using flux query. I will continue to work on this and if I succeed I will for sure post the solution here ! If another idea comes to your mind, do not hesitate to post it here !
Thanks again

Yeah they should be float

hello

This is a pivot, since influxdb is kind of column db , this is function is one of the most important/used in flux .And this is how you can transform data from influxdb to get familiar SQL format in one table, unique row (classic table scheme).
In fact you have to use almost it every time you query data.

for advanced usage, once you mastered this function you can think about UNION multiple measurement before pivot it. Instead of pivot multiple measurement a join it on a key.
This is have major impact on performance :slight_smile:
like 10x with linear scaling

1 Like

montre nous ceci @alexandrearmand

1 Like

Try this at the end of the Influx query:

|> pivot(rowKey: [“_time”], columnKey: [“_measurement”, “_field”], valueColumn: “_value”)

Great, it solved my problem