Correct: Query and Transformation for Geomap with Route Layer?

Hello everybody,
i am trying to use data from an influxdb bucket to visualize a Route using Grafana, but the route is not printed on the map.
The endresult should be a Dashboard to show a route of collected gps coordinates for a selected date.
While data is showing up in the table view it is only showing one decimal if i use the raw fields or run a Number Transformation on it.
The complete Float is only shown correctly if i run a String Transformation on it - but then the fields cannot be used anymore as longitude and latitude. Could that be the issue or am i missing something else?

I am aware that Route Layer is still in Beta - but maybe someone had some success with it?

This is my query:

from(bucket: “gpstracking_db”)
|> range(start: v.timeRangeStart, stop:v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “gpstracking_measurement” and (r._field == “longitude” or r._field == “latitude”))

In the bucket one measurement ist safed only Holding Datetime, Longitude, Latitude, Batterylevel. As the sensor is supposed top be battery operated

Thanks a lot

Welcome @clem1

Can you please provide sample data?


Hell @yosiasz,
i am trying to figure out how to access the data in raw format - maybe this screenshot is sufficient in the meantine if it is about the structure?


Not going to retype what you posted in screen shot.
in 8086 just see if you can access the following?


Thats what i thought, but for some reason i am missing the csv download option:

in that case type it up manually for us and post back


i am not quite sure if i understand your response correctly - sorry for that.

But if that is the structure, than this should be the writeup (lat,lon values changed, to different but valid ones) - does this help?


he structure does not matter, only the data. what you posted looks good but very sparse.

Hello yosiasz,
well then here is another Block:


The data is collected about every 20 seconds, the gps coordinates arent moving a lot, as the module is sitting at my work bench while i am working on it, so there might be some slight changes in the gps coordinates, but not a lot.

So i don´t expect it to create valid path as of now, but right now nothing is printed on the geomap - hence my question of this topic.


from(bucket: "gpstracking_db")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "gpstracking_measurement")
  |> filter(fn: (r) => r["_field"] == "batterylevel" or r["_field"] == "latitude" or r["_field"] == "longitude")
  |> filter(fn: (r) => r["tag1"] == "geo")
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")  
  |> drop(columns: ["_start", "_stop", "_measurement", "type"])

Thanks a lot @yosiasz,
this is the solution, i only had to delete the row
“|> filter(fn: (r) => r[“tag1”] == “geo”)” as i don´t have a tag in my data.

The markers and the path is working now with this query.

from(bucket: “gpstracking_db”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “gpstracking_measurement”)
|> filter(fn: (r) => r[“_field”] == “batterylevel” or r[“_field”] == “latitude” or r[“_field”] == “longitude”)
|> pivot(rowKey:[“_time”], columnKey: [“_field”], valueColumn: “_value”)
|> drop(columns: [“_start”, “_stop”, “_measurement”, “type”])

Cool. Do you see now the benefit of providing your data :wink:

1 Like