Show Multiple Routes in a single Geomap Panel


I’m trying to use the Geomap panel to display a set of AIS vessel tracks that we obtain using an AIS antenna. The data is saved in an InfluxDB. We query the data using Flux.

I can query the database for all currently existing AIS tracks in the database. However, I can not get a single geomap panel to show me all AIS tracks from a given time frame. I can only see one route. Is it possible to use a single Geomap panel to display multiple tracks, where we do not know the number of tracks in advance? we could have zero to many tracks at each selected time frame.

I checked this post. However, I was not able to distill a solution out of it.

We save our data with the following fields:

  • mmsi: int
  • lat: float
  • lon: float
  • shipname: string

We add the data to influxdb as is and set the tag ship_id to the value of the mmsi field.
We then run the following FluxQuery (I’m new to Flux, so I think this could be improved):

import "influxdata/influxdb/schema"

from(bucket: "test")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "ais")
  |> filter(fn: (r) => r["_field"] == "lat" or r["_field"] == "lon" or r["_field"] == "mmsi")
  |> drop(columns: ["_start", "_stop", "_measurement"])
  |> map(fn: (r) => ({ r with _value: string(v: r._value) }))  # necessary because otherwise group would not work.
  |> group(columns: ["ship_id"])
  |> schema.fieldsAsCols()

Here is some of the data we get when running the query:


As you can see, we get two tables. As far as I understood the geomap panel, we can display multiple routes if we can get one table per track. In this example, we have two tracks in our database and each is displayed in its own table.

If I run this query in Grafana with the Geomap panel and a route layer, I get the following result:

If I open the table view, I see that we have two tables:

However, Grafana is not able to show the two tracks.

If we do not use a tag and use a grafana transformation to group the tracks, we can see both tracks in the same Geomap. However, both tracks are connected.

Could it be that the route layer can not be used at all for the envisioned task?

We are using GrafanaOSS in Version: v10.2.3 (1e84fede54)

Thank you for reading this and your help is greatly appreciated =)
If you need any further information, let me know.

1 Like

Thanks for sharing sample data. Are you using the Beta Route Layer in geomap

Thank you for the reply.

Yes, we are using the Route (Beta) layer. I forgot to mention that.

1 Like

Thank you for this post-- I have a very similar problem. Slight differences: I am using an SQLite database (using the SQLite plugin) and have split up my database query output into multiple tables using the Partition by Values transformation. As you have noted, the Beta Route Layer only displays one route.

Wondering if you found a resolution to this. I am planning on opening an issue ticket