Grafana Geomap Route

Hello,

I want to display the GPS Tracking data as in a Grafana Geomap Panel with the route layer but I can’t get it to work.
I have the data in InfluxDB.
I have set up 2 queries in my Geomap Panel, one for latitude and one for longitude values.
I chose Layer Type “Route (Beta)”, Location Mode “Coords” and for Latitude Field the latitude query and for Longitude field the longitude query. But I get the Message “Select latitude/longitude fields”… Can someone help me?

Thanks a lot!
BR Tobias :slight_smile:

Data looks like this: (for longitude it looks the same)

Can you try rewriting your query to bring back both longitude and latitude together, or use the concatenate transformation to join yourbresults in to one?

sure that’s no problem, just need to know what the result needs to look like?

47.499847756736834, 17.098508689866655

like this?

That should be fine

Like this? Hmm still no idea how to plot the data… :confused:

I saw you had two queries, latitude and longitude. I said you should concatenate to get one set of results back, but still using separate latitude and longitude values. My data looks like this:

Why are these values separated that you have to have 2 queries

Can you show us your query ?

thanks for trying to help… I’am sorry but I dont know how to concatenate the values… I tried but I always get 2 time columns then.

They are separated because I thought they have to be separated…
with one query it’s also not working… this is my query:
Screenshot 2023-10-22 231012

Please provide your data as inline csv

Longitude,latitude,time,metric,value
45.55,-23.33,2023-10-22,sensor1,33.3

maybe you can tell me how to get this data?
I use node-red to send the longitude and latitude values into influx db… but probably I do something wrong…

when I use one query in grafana with 2 fields it shows no data…

@tobiasknabe

I think your function node in Node-RED is not correctly formatting the data for Influx. I would send the data into InfluxDB like this (with the timestamp being assigned at the moment you ingest the data into Influx):

msg.payload = [
    [{
        sensor: msg.payload
    },
    {
        latitude: -26,
        longitude: 28.4
    }]
];
return msg;

In the above, for every sensor value you send, there is an associated lat & lon value (which are tag values). Normally, depending on the precision used for lat/lon, you could easily end up with very high cardinality, which is not good. However, InfluxDB 3.0 has removed that barrier and now offers unlimited cardinality.

Ok, can you please post the schema of the table ? The columns names and the data types of these columna or fields of the table?

thanks @grant2 , I tried it with your function node but it’s not working for me…
each coordinate is now a tag with the timestamp as field value…
in grafana the geomap is not working for me with this data…

this is my function node I usually used for pushing data into influxDB with a batch node

let measurement = "sensors"

function addsensordata(device, value) {
    let record = {
        "measurement": measurement,
        "tags": {
            "device": device
        },
        "fields": {
            "soc": value.soc,
            "odometer": value.odometer,
            "range": value.range,
            "temp_inside": value.temp_inside,
            "temp_outside": value.temp_outside,
            "charge_current": value.charge_current,
            "charge_power": value.charge_power,
            "charge_limit": value.charge_limit,
            "charging_rate": value.charging_rate,
            "energy_added": value.energy_added,
            "tire_pressure_FL": value.tire_pressure_FL,
            "tire_pressure_FR": value.tire_pressure_FR,
            "tire_pressure_RL": value.tire_pressure_RL,
            "tire_pressure_RR": value.tire_pressure_RR,
            "location_tracker_latitude": value.location_tracker_latitude,
            "location_tracker_longitude": value.location_tracker_longitude,
            "location_tracker_gps": value.location_tracker_gps,
            "location_tracker_speed": value.location_tracker_speed,
        }
    };
    return record;
}

let data = [];

data.push(addsensordata("tesla_mama", msg.payload));


msg.payload = data;


let tesla_mama = global.get("tesla_mama");
global.set("tesla_mama", tesla_mama);

return msg;

Hi @tobiasknabe

Let’s go back to your function node and tag + fields that you set up there.

Comparing your field list with the original screenshot you shared, it appears that this field:

location_tracker_gps": value.location_tracker_gps

is merely a concatenation of these 2 fields:

location_tracker_latitude": value.location_tracker_latitude
location_tracker_longitude": value.location_tracker_longitude

as shown here:

Your query should produce results which have latitude and longitude as separate fields (columns) in the above table. I know you wrote above:

when I use one query in grafana with 2 fields it shows no data…

but what exactly is shown in the red exclamation mark message? Your query is probably wrong and that is why you cannot see lat & lon as two separate fields.

Hi @grant2

I don’t know why but now it seems to work to choose just one query but 2 fields.
My table looks like this now, when I select 2 fields, so I can select from the 2 fields but they are not in the same table:

When I use the transformation concatenate it looks like this: