Displaying Images in GeoMap Panel

  • What Grafana version and what operating system are you using?
    We are using Grafana 10.4.1 on a Linux host.

  • What are you trying to achieve?
    I am querying my InfluxDB database with a Flux query and trying to show unique assessments (think of it like a tag, with each different assessment/tag having a unique GUID) on a geomap panel. I am also running an SQL query against a SQL Server database to pull in icon “photos” that I want to display on my Geomap panel at the locations returned in the first query. I have an inner join transform running against a common field between the two queries.

  • How are you trying to achieve it?
    I am using the following flux query “A” in Grafana:

from(bucket: "Assessment_Data")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "current_assessments")
  |> filter(fn: (r) => r["_field"] == "assessmentlat" or r["_field"] == "assessmentlon" or r["_field"] == "assessmentid" or r["_field"] == "assessmentcreated" or r["_field"] == "assessmentcomments" or r["_field"] == "assessmentcreatedby" or r["_field"] == "assessmentelement" or r["_field"] == "assessmentfeeder" or r["_field"] == "assessmentcategory")
  |> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value" )
  |> drop(columns: ["_start", "_stop"])
  |> group(columns: ["assessmentid"])
  |> last(column: "_time")

And, I am using the following SQL query “B” in the same Grafana panel:

SELECT Name AS "assessmentcategory", ImageIcon FROM D*snip*SQLReplica.dbo.DefaultType

As described above, I am using a Join transform to do an inner join against the assessmentcategory field which is present in both queries A and B. I then configured the Assessments data layer as a Photo using the lat and lon out of Query A to pick up locations and using the ImageIcon field that originated with query B and contains a binary bitmap image file.

  • What happened?
    I got the following map:
    2024-03-25 17_08_02-Windowpanel

  • What did you expect to happen?
    I expected a GeoMap with my icons at each assessment location instead of question marks.

I realize that this is a beta feature, but I was hoping to see how it worked and get an idea if it could be a good long-term solution for one of our needs. Any guidance on what I am doing wrong or missing here would be much appreciated.

are you using ImageIcon as source of the icons? If so what is in that column, and is it a folder that grafana has access to?

Yes, ImageIcon is the source of the icons. It contains the binary-encoded bitmap of the icon graphic.

you might need to do something like this for that specific image type

SELECT concat('data:image/png;base64,',	
CAST('' as XML).value('xs:base64Binary(sql:column("img"))', 'VARCHAR(MAX)')) AS ImageIcon
from table
2 Likes

Beautiful! That fixed it! I don’t understand exactly what that bit of SQL language did, but I will research it and figure that out. Thank you so much for your help!
2024-03-25 18_09_07-Window

2 Likes