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?

_time,_value,_field
2023-06-27T12:00:00Z,52.4943235,latitude
2023-06-27T12:20:00Z,0.716637,longitude
2023-06-27T12:20:00Z,23.5,Batterylevel

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?

grafik

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

image

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

_time,_value,_field
2023-06-27T12:00:00Z,52.4943235,latitude
2023-06-27T12:20:00Z,0.716637,longitude
2023-06-27T12:20:00Z,23.5,Batterylevel

Hello,
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?

_time,_value,_field,_measurement
2023-09-19T10:00:00.000Z,49.846788,latitude,gpstracking_measurement
2023-09-19T10:00:00.000Z,7.631818,longitude,gpstracking_measurement
2023-09-19T10:00:00.000Z,3.789,batterylevel,gpstracking_measurement

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

Hello yosiasz,
well then here is another Block:

2023-09-19T12:10:00.000Z,49.846776,latitude,gpstracking_measurement
2023-09-19T12:10:00.000Z,7.631812,longitude,gpstracking_measurement
2023-09-19T12:10:00.000Z,4.124,batterylevel,gpstracking_measurement

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.

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