GeoMap, new feature requests, influx work-arounds

(WRT Grafana 8.5.5) Thank you for the GeoMap panel. I have been banging my head against some things, and I wanted to share work-arounds I have not seen discussed elsewhere

The queries for influx seem tetchy.

  1. Multiple queries do not work, e.g.: Data from “Query B” can not be added to any layer. A much more complex query (see A) is required.
  2. It seems a bit out of spirit with other panels, but for Influx queries, you must “Format as” “table”.
  3. Updates for GeoMap panel seem to be out of sync with other panels often. Not a big issue, as they eventually line up. Sort of.
  4. (not really a geomap issue; more of a data side issue.) Averaging lon/lat values is almost never what you want if you are dealing with global data. Esp. at the poles and antimeridian.

Feature requests:

  1. Mercator is evil. Even if you don’t support a full-featured projection set, at the very least please support EPSG:4326. At the very least with 4326, all WGS-84 coordinates map to some place on the map! (also, see ArcGIS Client Side Projection example. (this has been mentioned elsewhere, but 4326 is more realistic than Dymaxion.)
  2. Please add support for shapes (GeoJSON) retrieved via data source. For example, a PostgreSQL data source indexed by time with shapes as a column. (also asked for elsewhere.)
  3. GeoHash is vastly under-documented. Also, please consider supporting 64bit integer geohashes (e.g. XYZ Morton GeoHashes.)
  4. Please add support for connecting points in a series. (also asked for elsewhere.)
  5. Consider supporting some sort of x/y/z coordinates. Full J2000 coordinates may not be workable, but Earth Fixed coordinates on a unit sphere should be workable. It solves various time-series DB averaging mentioned above.

Welcome

  1. Are you sure about that? Could you please provide some sample data that could help us uncomplicate your influxql query.
  2. Other panels also have that option of either time series or table
  3. Not sure I understand this part. What do you mean with out of sync
  4. You do not need to do these aggregation functions. If you could provide sample data we could help.

Support for GeoJSON

image

If you could provide some sample postgre DDL and DML, we might be able to help

(update. Container version got bumped. Now testing with 9.0.0. I see no changes.)

  1. Not sure the best way to give you the data, but, these are the tables Grafana is returning via Inspect->Data->Download CSV:

A:

"Time","sensor","lon","lat","alon","alat"
1655430480000,FOO,-143.5374885620802,-73.61067816184931,-152.81036135746504,-71.44314333612294
1655430510000,FOO,-147.3309429039493,-75.06248857656448,-156.82744346951955,-72.71328852641788
1655430540000,FOO,-151.87235874761177,-76.4435190419781,-161.43754476753475,-73.89453015236981
1655430570000,FOO,-157.35570480514082,-77.7299891513818,-166.7323730554401,-74.96564998504232
1655430600000,FOO,-164.00211744485065,-78.8891416694687,-144.27039695427808,-75.90123650315186
1655430630000,FOO,-171.9974804807729,-79.87502401909023,-3.644108053179871,-76.66956498889505
1655430660000,FOO,174.82214713872693,-80.63854364161621,160.11652379468035,-77.24243609880553
1655430690000,FOO,167.7216987602346,-81.11879483899989,164.4663016059218,-77.5878821024443
1655430720000,FOO,156.18154277605072,-81.25891337907468,155.8994469601902,-77.68421207618094
1655430750000,FOO,144.6703526518379,-81.07328307170997,147.35806863877508,-77.5253544766053
1655430780000,FOO,134.02579700282982,-80.55230962969844,139.22839899759185,-77.12163237351206
1655430810000,FOO,124.73449351890609,-79.7555447791718,131.7698127655175,-76.49688665988013
1655430480000,BAR,-143.5374885620802,-73.61067816184931,-131.2733028877406,-75.16573195601411
1655430510000,BAR,-147.3309429039493,-75.06248857656448,-134.01519046937776,-76.77056179113642
1655430540000,BAR,-151.87235874761177,-76.4435190419781,-137.41196690858524,-78.33725983213158
1655430570000,BAR,-157.35570482692168,-77.72998915824039,-141.72913697897948,-79.84975008092233
1655430600000,BAR,-164.00211744485065,-78.8891416694687,-147.37079397889494,-81.28293494294813
1655430630000,BAR,-171.9974804807729,-79.87502401909023,-154.95760687417064,-82.59269151925095
1655430660000,BAR,174.82214713872693,-80.63854364161621,-105.42892301741357,-83.71760488643403
1655430690000,BAR,167.7216987602346,-81.11879483899989,73.21895156892074,-84.5369464598052
1655430720000,BAR,156.18154277404415,-81.25891337907468,147.273404999576,-84.81500250289483
1655430750000,BAR,144.6703526518379,-81.07328307170997,130.5171791320301,-84.3654757521367
1655430780000,BAR,134.02579700282982,-80.55230962969844,116.48585411546527,-83.45579826379168
1655430810000,BAR,124.73449351890609,-79.7555447791718,106.76106372302866,-82.2764689150398

B:

"Time","sensor","lonE","latE"
1655430480000,ICK,-153.2983519548551,-71.43355123011625
1655430510000,ICK,-157.33714294452815,-72.68944076254839
1655430540000,ICK,-161.99072971572846,-73.86108605464455
1655430570000,ICK,-165.2650821966279,-74.92055101398158
1655430600000,ICK,-126.96588070824872,-75.83791493669617
1655430630000,ICK,11.231682525086336,-76.58901830737138
1655430660000,ICK,156.49409720489774,-77.14520677878559
1655430690000,ICK,163.89762502154053,-77.47190545446718
1655430720000,ICK,155.39441446038967,-77.55173288216504
1655430750000,ICK,146.91699169635038,-77.37843108588937
1655430780000,ICK,138.9020904474493,-76.96493761096185
1655430810000,ICK,131.55274206070735,-76.33456319656624
1655430840000,ICK,,

(Sensor names changed to protect the innocent)

  1. Yes. I am saying that if one selects “Time Series”, one gets no results. This took some experiments to figure out. I am not familiar with what Grafana does underneath the hood, so there may be a reason.
  2. This is hardest to reproduce and demonstrate. For now let’s assume that it is an artifact of my environment.
  3. Aggregation functions are for performance and sanity. My source data is about 6.5hz. For now, “median” works better than “mean”. YMMV

For GeoJSON, consider this a request for dynamic shapes to be supported. (up to a sane limits.) I don’t have a postgis DB set up for myself right now, but I will work out some queries later.

Thank you.

1 Like

here is one simple approach by creating a small nodejs express api
this example is for a file on disk, but the options are endless, you can plug in your db etc.

const express = require('express')

const cors = require('cors');

const bodyParser = require('body-parser')

const parse = require('csv').parse

const mysql = require('mysql')

const fs = require('fs');

const fetch = require('node-fetch');

const FormData = require('form-data');

const app = express();

const port = 5000;

require('dotenv').config();

app.use(bodyParser.json())

app.use(express.static('public'))

app.use(cors());

app.options('*', cors()) /

/* */

app.get('/geo', (req, res) => {

let rawdata = fs.readFileSync('./data/earthquakes.geojson');

let geo = JSON.parse(rawdata);

return res.json(geo)

})

using your data with influxql

SELECT “latE”, “lonE”, “sensor” FROM “map-rp”.“zoo” WHERE $timeFilter

Grafana is treating sensor as a column, but it is a tag.
Query A:

SELECT median("nadirLon") AS "lon", median("nadirLat") AS "lat", mean("lon") AS "alon", mean("lat") AS "alat" FROM "GEO" WHERE ("sensor" = 'FOO' OR "sensor" = 'BAR') AND $timeFilter GROUP BY time($__interval), "sensor" fill(none)

For Query B:

SELECT mean("lon") AS "lonE", mean("lat") AS "latE" FROM "GEO" WHERE ("sensor" = 'ICK') AND $timeFilter GROUP BY time($__interval), "sensor" fill(null)

Here are my definitions for my layers:



Here is the resulting Geomap:

if I only change from Geomap to time series, and change nothing else I get:

and what did you expect it to be? not sure what you are attempting, plotting a map or a time series/bar chart

Also why are you doing median and mean?

SELECT median("nadirLon") AS "lon", median("nadirLat") AS "lat", mean("lon") AS "alon", mean("lat") AS "alat" FROM "GEO" WHERE ("sensor" = 'FOO' OR "sensor" = 'BAR') AND $timeFilter GROUP BY time($__interval), "sensor" fill(none)

Please note that on GeoMap there is data for only for (lon,lat) and (alon, alat); there is no data for (lonE,latE). This is clear that no layer 4 is displayed, and there is no heatmap data. (Heatmap was chosen only because it would stick out more. It doesn’t show up no matter what I change it to.)

On the Time Series there is data for all three pairs.

I expect GeoMap to have 3 layers, and time series to have 6 traces. GeoMap has only two layers although three are defined.

In short, coding by coincidence. :stuck_out_tongue_winking_eye:

But, in the case where median is used, it represents a single observation. At this time it is at that location. In cases where mean is used, it is actually the mean of a mean.

Obviously I need to change how I calculate the centroid of the data for that point in time. Once that is done, the median is probably what I want. Until then, well, it is already wrong, why not let it be a little more wrong?

:joy: I definitely need what you had this morning. one thing at a time as I always say to my Dad.
Let’s start with geomap and walk our way to the other stuff. Either you had some good coffee this morning or I need some.

So here are 2 items plotted

one geojson, the other csv long lat data

the reason you might not be seeing heatmap because it is layered on top of same long lat

On your chart try this:
Create an infinity/csv/inline data set using the csv text provided above (editing out the " )

Create a second query “B” using the second CSV above

Now create three layers from this data. layer1 for lat/lon, layer2 for alat/alon, and layer3 for latE,lonE.

Note that layer 3 does not show up.

Remove query A

redefine layer1 to be latE,lonE.

Note that it does show up.

or you can post the json model of the above dashboard :stuck_out_tongue_winking_eye:


Or I could just post the json model of the above dashboard.

{
  "__inputs": [
    {
      "name": "DS_INFINITY",
      "label": "Infinity",
      "description": "",
      "type": "datasource",
      "pluginId": "yesoreyeram-infinity-datasource",
      "pluginName": "Infinity"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "panel",
      "id": "geomap",
      "name": "Geomap",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.0.0-c18ba28cpre"
    },
    {
      "type": "datasource",
      "id": "yesoreyeram-infinity-datasource",
      "name": "Infinity",
      "version": "1.0.0-dev.4"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "uid": "grafana"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "basemap": {
          "config": {},
          "name": "Layer 0",
          "type": "default"
        },
        "controls": {
          "mouseWheelZoom": true,
          "showAttribution": true,
          "showDebug": false,
          "showScale": false,
          "showZoom": true
        },
        "layers": [
          {
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "dark-green"
                },
                "opacity": 0.4,
                "rotation": {
                  "fixed": 0,
                  "max": 360,
                  "min": -360,
                  "mode": "mod"
                },
                "size": {
                  "fixed": 5,
                  "max": 15,
                  "min": 2
                },
                "symbol": {
                  "fixed": "img/icons/marker/circle.svg",
                  "mode": "fixed"
                },
                "textConfig": {
                  "fontSize": 12,
                  "offsetX": 0,
                  "offsetY": 0,
                  "textAlign": "center",
                  "textBaseline": "middle"
                }
              }
            },
            "location": {
              "latitude": "lat",
              "longitude": "lon",
              "mode": "coords"
            },
            "name": "Layer 1",
            "tooltip": true,
            "type": "markers"
          },
          {
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "dark-red"
                },
                "opacity": 0.4,
                "rotation": {
                  "fixed": 0,
                  "max": 360,
                  "min": -360,
                  "mode": "mod"
                },
                "size": {
                  "fixed": 5,
                  "max": 15,
                  "min": 2
                },
                "symbol": {
                  "fixed": "img/icons/marker/circle.svg",
                  "mode": "fixed"
                },
                "textConfig": {
                  "fontSize": 12,
                  "offsetX": 0,
                  "offsetY": 0,
                  "textAlign": "center",
                  "textBaseline": "middle"
                }
              }
            },
            "location": {
              "latitude": "alat",
              "longitude": "alon",
              "mode": "coords"
            },
            "name": "Layer 2",
            "tooltip": true,
            "type": "markers"
          },
          {
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "dark-blue"
                },
                "opacity": 0.4,
                "rotation": {
                  "fixed": 0,
                  "max": 360,
                  "min": -360,
                  "mode": "mod"
                },
                "size": {
                  "fixed": 5,
                  "max": 15,
                  "min": 2
                },
                "symbol": {
                  "fixed": "img/icons/marker/circle.svg",
                  "mode": "fixed"
                },
                "textConfig": {
                  "fontSize": 12,
                  "offsetX": 0,
                  "offsetY": 0,
                  "textAlign": "center",
                  "textBaseline": "middle"
                }
              }
            },
            "location": {
              "latitude": "B latE",
              "longitude": "B lonE",
              "mode": "coords"
            },
            "name": "Layer 3",
            "tooltip": true,
            "type": "markers"
          }
        ],
        "view": {
          "id": "zero",
          "lat": 0,
          "lon": 0,
          "zoom": 1
        }
      },
      "pluginVersion": "9.0.0-c18ba28cpre",
      "targets": [
        {
          "columns": [
            {
              "selector": "Time",
              "text": "time",
              "type": "timestamp_epoch"
            },
            {
              "selector": "lon",
              "text": "lon",
              "type": "number"
            },
            {
              "selector": "lat",
              "text": "lat",
              "type": "number"
            },
            {
              "selector": "alon",
              "text": "alon",
              "type": "number"
            },
            {
              "selector": "alat",
              "text": "alat",
              "type": "number"
            }
          ],
          "csv_options": {
            "columns": "",
            "comment": "",
            "delimiter": ",",
            "relax_column_count": false,
            "skip_empty_lines": false,
            "skip_lines_with_error": false
          },
          "data": "Time,sensor,lon,lat,alon,alat\n1655430480000,FOO,-143.5374885620802,-73.61067816184931,-152.81036135746504,-71.44314333612294\n1655430510000,FOO,-147.3309429039493,-75.06248857656448,-156.82744346951955,-72.71328852641788\n1655430540000,FOO,-151.87235874761177,-76.4435190419781,-161.43754476753475,-73.89453015236981\n1655430570000,FOO,-157.35570480514082,-77.7299891513818,-166.7323730554401,-74.96564998504232\n1655430600000,FOO,-164.00211744485065,-78.8891416694687,-144.27039695427808,-75.90123650315186\n1655430630000,FOO,-171.9974804807729,-79.87502401909023,-3.644108053179871,-76.66956498889505\n1655430660000,FOO,174.82214713872693,-80.63854364161621,160.11652379468035,-77.24243609880553\n1655430690000,FOO,167.7216987602346,-81.11879483899989,164.4663016059218,-77.5878821024443\n1655430720000,FOO,156.18154277605072,-81.25891337907468,155.8994469601902,-77.68421207618094\n1655430750000,FOO,144.6703526518379,-81.07328307170997,147.35806863877508,-77.5253544766053\n1655430780000,FOO,134.02579700282982,-80.55230962969844,139.22839899759185,-77.12163237351206\n1655430810000,FOO,124.73449351890609,-79.7555447791718,131.7698127655175,-76.49688665988013\n1655430480000,BAR,-143.5374885620802,-73.61067816184931,-131.2733028877406,-75.16573195601411\n1655430510000,BAR,-147.3309429039493,-75.06248857656448,-134.01519046937776,-76.77056179113642\n1655430540000,BAR,-151.87235874761177,-76.4435190419781,-137.41196690858524,-78.33725983213158\n1655430570000,BAR,-157.35570482692168,-77.72998915824039,-141.72913697897948,-79.84975008092233\n1655430600000,BAR,-164.00211744485065,-78.8891416694687,-147.37079397889494,-81.28293494294813\n1655430630000,BAR,-171.9974804807729,-79.87502401909023,-154.95760687417064,-82.59269151925095\n1655430660000,BAR,174.82214713872693,-80.63854364161621,-105.42892301741357,-83.71760488643403\n1655430690000,BAR,167.7216987602346,-81.11879483899989,73.21895156892074,-84.5369464598052\n1655430720000,BAR,156.18154277404415,-81.25891337907468,147.273404999576,-84.81500250289483\n1655430750000,BAR,144.6703526518379,-81.07328307170997,130.5171791320301,-84.3654757521367\n1655430780000,BAR,134.02579700282982,-80.55230962969844,116.48585411546527,-83.45579826379168\n1655430810000,BAR,124.73449351890609,-79.7555447791718,106.76106372302866,-82.2764689150398",
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_INFINITY}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "refId": "A",
          "root_selector": "",
          "source": "inline",
          "type": "csv",
          "url": "https://jsonplaceholder.typicode.com/users",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        },
        {
          "columns": [
            {
              "selector": "Time",
              "text": "Time",
              "type": "timestamp_epoch"
            },
            {
              "selector": "lonE",
              "text": "lonE",
              "type": "number"
            },
            {
              "selector": "latE",
              "text": "latE",
              "type": "number"
            }
          ],
          "data": "Time,sensor,lonE,latE\n1655430480000,ICK,-153.2983519548551,-71.43355123011625\n1655430510000,ICK,-157.33714294452815,-72.68944076254839\n1655430540000,ICK,-161.99072971572846,-73.86108605464455\n1655430570000,ICK,-165.2650821966279,-74.92055101398158\n1655430600000,ICK,-126.96588070824872,-75.83791493669617\n1655430630000,ICK,11.231682525086336,-76.58901830737138\n1655430660000,ICK,156.49409720489774,-77.14520677878559\n1655430690000,ICK,163.89762502154053,-77.47190545446718\n1655430720000,ICK,155.39441446038967,-77.55173288216504\n1655430750000,ICK,146.91699169635038,-77.37843108588937\n1655430780000,ICK,138.9020904474493,-76.96493761096185\n1655430810000,ICK,131.55274206070735,-76.33456319656624\n1655430840000,ICK,,",
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_INFINITY}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "hide": false,
          "refId": "B",
          "root_selector": "",
          "source": "inline",
          "type": "csv",
          "url": "https://jsonplaceholder.typicode.com/users",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        }
      ],
      "title": "JSON",
      "type": "geomap"
    }
  ],
  "refresh": "",
  "schemaVersion": 36,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "2022-06-17T01:48:00.000Z",
    "to": "2022-06-17T01:54:00.000Z"
  },
  "timepicker": {},
  "timezone": "",
  "title": "try",
  "uid": "try",
  "version": 2,
  "weekStart": ""
}

It doesn’t show up :cold_face::exploding_head::scream:

A-hah! It isn’t just me! Finally figured out how to distil the problem down to a testable, portable, actionable bug report! Woooo! I deserve a cookie!

1 Like

Why didnt you say so in first place :joy:

Can you try to offset the long lats a bit. Maybe same coordinates being overlaid one on top of other cancels one out

Deep breath…

It isn’t the close data points. (if it was, that would be a bug too.)

Consider the following. The first has its data in a single “query”, the second has it split between the two. That’s it. The first one displays two layers, the second does not.

I don’t think I can meaningfully provide a simpler example of the bug.

{
  "__inputs": [
    {
      "name": "DS_INFINITY",
      "label": "Infinity",
      "description": "",
      "type": "datasource",
      "pluginId": "yesoreyeram-infinity-datasource",
      "pluginName": "Infinity"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "panel",
      "id": "geomap",
      "name": "Geomap",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.0.0-c18ba28cpre"
    },
    {
      "type": "datasource",
      "id": "yesoreyeram-infinity-datasource",
      "name": "Infinity",
      "version": "1.0.0-dev.4"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "uid": "grafana"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "basemap": {
          "config": {},
          "name": "Layer 0",
          "type": "default"
        },
        "controls": {
          "mouseWheelZoom": true,
          "showAttribution": true,
          "showDebug": false,
          "showScale": false,
          "showZoom": true
        },
        "layers": [
          {
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "dark-green"
                },
                "opacity": 0.4,
                "rotation": {
                  "fixed": 0,
                  "max": 360,
                  "min": -360,
                  "mode": "mod"
                },
                "size": {
                  "fixed": 5,
                  "max": 15,
                  "min": 2
                },
                "symbol": {
                  "fixed": "img/icons/marker/circle.svg",
                  "mode": "fixed"
                },
                "textConfig": {
                  "fontSize": 12,
                  "offsetX": 0,
                  "offsetY": 0,
                  "textAlign": "center",
                  "textBaseline": "middle"
                }
              }
            },
            "location": {
              "latitude": "lata",
              "longitude": "lona",
              "mode": "coords"
            },
            "name": "Layer 1",
            "tooltip": true,
            "type": "markers"
          },
          {
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "dark-red"
                },
                "opacity": 0.4,
                "rotation": {
                  "fixed": 0,
                  "max": 360,
                  "min": -360,
                  "mode": "mod"
                },
                "size": {
                  "fixed": 5,
                  "max": 15,
                  "min": 2
                },
                "symbol": {
                  "fixed": "img/icons/marker/circle.svg",
                  "mode": "fixed"
                },
                "textConfig": {
                  "fontSize": 12,
                  "offsetX": 0,
                  "offsetY": 0,
                  "textAlign": "center",
                  "textBaseline": "middle"
                }
              }
            },
            "location": {
              "latitude": "latb",
              "longitude": "lonb",
              "mode": "coords"
            },
            "name": "Layer 2",
            "tooltip": true,
            "type": "markers"
          }
        ],
        "view": {
          "id": "zero",
          "lat": 0,
          "lon": 0,
          "zoom": 1
        }
      },
      "pluginVersion": "9.0.0-c18ba28cpre",
      "targets": [
        {
          "columns": [
            {
              "selector": "time",
              "text": "",
              "type": "timestamp_epoch"
            },
            {
              "selector": "lata",
              "text": "",
              "type": "number"
            },
            {
              "selector": "lona",
              "text": "",
              "type": "number"
            },
            {
              "selector": "latb",
              "text": "",
              "type": "number"
            },
            {
              "selector": "lonb",
              "text": "",
              "type": "number"
            }
          ],
          "data": "time,lata,lona,latb,lonb\n1655430480000,0,0,10,0\n1655430510000,10,10,20,10\n1655430540000,20,20,30,20",
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_INFINITY}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "hide": false,
          "refId": "A",
          "root_selector": "",
          "source": "inline",
          "type": "csv",
          "url": "",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        }
      ],
      "type": "geomap"
    }
  ],
  "refresh": false,
  "schemaVersion": 36,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "2022-06-17T01:48:00.000Z",
    "to": "2022-06-17T01:54:00.000Z"
  },
  "timepicker": {},
  "timezone": "",
  "title": "try",
  "uid": "try",
  "version": 2,
  "weekStart": ""
}

vs

{
  "__inputs": [
    {
      "name": "DS_INFINITY",
      "label": "Infinity",
      "description": "",
      "type": "datasource",
      "pluginId": "yesoreyeram-infinity-datasource",
      "pluginName": "Infinity"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "panel",
      "id": "geomap",
      "name": "Geomap",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.0.0-c18ba28cpre"
    },
    {
      "type": "datasource",
      "id": "yesoreyeram-infinity-datasource",
      "name": "Infinity",
      "version": "1.0.0-dev.4"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "uid": "grafana"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "basemap": {
          "config": {},
          "name": "Layer 0",
          "type": "default"
        },
        "controls": {
          "mouseWheelZoom": true,
          "showAttribution": true,
          "showDebug": false,
          "showScale": false,
          "showZoom": true
        },
        "layers": [
          {
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "dark-green"
                },
                "opacity": 0.4,
                "rotation": {
                  "fixed": 0,
                  "max": 360,
                  "min": -360,
                  "mode": "mod"
                },
                "size": {
                  "fixed": 5,
                  "max": 15,
                  "min": 2
                },
                "symbol": {
                  "fixed": "img/icons/marker/circle.svg",
                  "mode": "fixed"
                },
                "textConfig": {
                  "fontSize": 12,
                  "offsetX": 0,
                  "offsetY": 0,
                  "textAlign": "center",
                  "textBaseline": "middle"
                }
              }
            },
            "location": {
              "latitude": "lata",
              "longitude": "lona",
              "mode": "coords"
            },
            "name": "Layer 1",
            "tooltip": true,
            "type": "markers"
          },
          {
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "dark-red"
                },
                "opacity": 0.4,
                "rotation": {
                  "fixed": 0,
                  "max": 360,
                  "min": -360,
                  "mode": "mod"
                },
                "size": {
                  "fixed": 5,
                  "max": 15,
                  "min": 2
                },
                "symbol": {
                  "fixed": "img/icons/marker/circle.svg",
                  "mode": "fixed"
                },
                "textConfig": {
                  "fontSize": 12,
                  "offsetX": 0,
                  "offsetY": 0,
                  "textAlign": "center",
                  "textBaseline": "middle"
                }
              }
            },
            "location": {
              "latitude": "B latb",
              "longitude": "B lonb",
              "mode": "coords"
            },
            "name": "Layer 2",
            "tooltip": true,
            "type": "markers"
          }
        ],
        "view": {
          "id": "zero",
          "lat": 0,
          "lon": 0,
          "zoom": 1
        }
      },
      "pluginVersion": "9.0.0-c18ba28cpre",
      "targets": [
        {
          "columns": [
            {
              "selector": "time",
              "text": "",
              "type": "timestamp_epoch"
            },
            {
              "selector": "lata",
              "text": "",
              "type": "number"
            },
            {
              "selector": "lona",
              "text": "",
              "type": "number"
            }
          ],
          "data": "time,lata,lona\n1655430480000,0,0\n1655430510000,10,10\n1655430540000,20,20",
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_INFINITY}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "hide": false,
          "refId": "A",
          "root_selector": "",
          "source": "inline",
          "type": "csv",
          "url": "https://jsonplaceholder.typicode.com/users",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        },
        {
          "columns": [
            {
              "selector": "time",
              "text": "",
              "type": "timestamp_epoch"
            },
            {
              "selector": "latb",
              "text": "",
              "type": "number"
            },
            {
              "selector": "lonb",
              "text": "",
              "type": "number"
            }
          ],
          "data": "time,latb,lonb\n1655430480000,10,0\n1655430510000,20,10\n1655430540000,30,20",
          "datasource": {
            "type": "yesoreyeram-infinity-datasource",
            "uid": "${DS_INFINITY}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "hide": false,
          "refId": "B",
          "root_selector": "",
          "source": "inline",
          "type": "csv",
          "url": "",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        }
      ],
      "type": "geomap"
    }
  ],
  "refresh": false,
  "schemaVersion": 36,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "2022-06-17T01:48:00.000Z",
    "to": "2022-06-17T01:54:00.000Z"
  },
  "timepicker": {},
  "timezone": "",
  "title": "try",
  "uid": "try",
  "version": 2,
  "weekStart": ""
}
1 Like

Setup via docker:

docker pull postgis/postgis:14-3.2
docker run --name post -e POSTGRES_PASSWORD=asdf -d postgis/postgis:14-3.2
docker exec -it post psql -U postgres

Simplified Schema:

CREATE TABLE areas (
   id SERIAL PRIMARY KEY,
   name VARCHAR(128),
   time timestamp,
   area geography(POLYGON,4326)
);

and an insert:

 insert into areas (name,time,area) values
 (
 'FooBazBar',
 '2022-06-24 01:45:36',
 ST_GeomFromGeoJSON('
         { "type": "Polygon", "coordinates": [ [ [ -132.249058188461817, -26.074320237899812], [ -126.499537998522385, -27.170304847927795], [ -122.873952754529242, -27.763143901901344], [ -124.431979060722398, -33.338683913190224], [ -126.146300230422653, -38.895544747106257], [ -130.249883443244187, -38.200048436106258], [ -136.680050179172923, -36.839287691851851], [ -134.313903173246217, -31.484258150749906], [ -132.249058188461817, -26.074320237899812] ] ] }'
 )
 )
 ;

Now, it would be very easy to have a case where too much data is generated, but that is true for all parts of Grafana. What I am suggesting here is that with some back-end work, a conventional Grafana DataSource could provide GeoJSON features in addition to just lat/lon points.

Thank you

1 Like

We do thisvia nodejs/express rest api and use another geomap plugin

Se my example here

You can of course make it read from a database also

1 Like