Trying to use Worldmap with JSON location source, unsuccessfully

Hi there, I’m trying to use Worldmap with a custom set of locations that I’m providing via a JSON ( not JSONP ) service. I’m using a local Node-red service for this. I test this service as follows, it appears to do as I expect -

mderouss@laptop2:~$ curl -i http://localhost:1880/devices
HTTP/1.1 200 OK
X-Powered-By: Express
content-type: application/json; charset=utf-8
Content-Length: 4322
ETag: W/“10e2-z3rZ2f8ybQS7eEpDL4y93KnJlWU”
Date: Wed, 20 Feb 2019 15:19:02 GMT
Connection: keep-alive

[
{
“key”: “0”,
“latitude”: 51.2615362,
“longitude”: -1.0970214,
“name”: “Makerspace”
},
etc.

I’m using Influxdb to supply measurement data to grafana. The measurements include a tag called ‘hardware_serial’, and I want to use this as the ‘key’ value to pick up the location data. As far as I can tell, the measurement query is working as expected. I see a response with 40 groups corresponding to hardware_serial values, each containing the time and field values that I expect. From the Query inspector, truncated for brevity -

xhrStatus:“complete”
request:Object
method:“GET”
url:“api/datasources/proxy/1/query”
params:Object
db:“BMProtoAirQuality”
q:“SELECT “pm10” FROM “AirQuality” WHERE time >= now() - 6h GROUP BY “hardware_serial””
epoch:“ms”
data:null
precision:“ms”
response:Object
results:Array[1]
0:Object
statement_id:0
series:Array[40]
0:Object
name:“AirQuality”
tags:Object
columns:Array[2]
0:“time”
1:“pm10”
values:Array[22]
0:Array[1550676961858,315]
1:Array[1550677041991,163]
2:Array[1550677122068,112]
3:Array[1550677202143,41]
etc.

However, nothing is appearing on my map, and I see no evidence that Grafana is actually requesting location data from the JSON service.

In the ‘Worldmap’ section of the Worldmap panel editor, I have ‘Location data’ set to ‘JSON endpoint’, the aggregation set to ‘current’, and the URL set to ‘http://localhost:1880/devices’.

What am I missing here ?

FYI, the panel JSON ( jsonUrl is mangled to permit inclusion, is really same as above ) -

{
“circleMaxSize”: 30,
“circleMinSize”: 2,
“colors”: [
“rgba(245, 54, 54, 0.9)”,
“rgba(237, 129, 40, 0.89)”,
“rgba(50, 172, 45, 0.97)”
],
“datasource”: “InfluxDB”,
“decimals”: 0,
“esMetric”: “Count”,
“gridPos”: {
“h”: 15,
“w”: 24,
“x”: 0,
“y”: 0
},
“hideEmpty”: false,
“hideZero”: false,
“id”: 2,
“initialZoom”: “14”,
“jsonUrl”: “htt p:/ / localhost:1880/devices”,
“links”: ,
“locationData”: “json endpoint”,
“mapCenter”: “custom”,
“mapCenterLatitude”: “51.2645123”,
“mapCenterLongitude”: “-1.0816068”,
“maxDataPoints”: 1,
“mouseWheelZoom”: false,
“showLegend”: true,
“stickyLabels”: false,
“tableQueryOptions”: {
“geohashField”: “geohash”,
“latitudeField”: “latitude”,
“longitudeField”: “longitude”,
“metricField”: “metric”,
“queryType”: “geohash”
},
“targets”: [
{
“groupBy”: [
{
“type”: “tag”,
“params”: [
“hardware_serial”
]
}
],
“measurement”: “AirQuality”,
“orderByTime”: “ASC”,
“policy”: “default”,
“refId”: “A”,
“resultFormat”: “time_series”,
“select”: [
[
{
“params”: [
“pm10”
],
“type”: “field”
}
]
],
“tags”: ,
“hide”: false,
“query”: “SELECT "pm10" FROM "AirQuality" WHERE $timeFilter GROUP BY "hardware_serial"”,
“rawQuery”: false,
“alias”: “$tag_hardware_serial”
}
],
“thresholds”: “0,10”,
“title”: “Air Quality”,
“transparent”: true,
“type”: “grafana-worldmap-panel”,
“unitPlural”: “”,
“unitSingle”: “”,
“valueName”: “current”
}

My guess: you have a CORS issue , so browser blocks your json load. Or you are loading http json from https dashboard site. Check browser console.

Hello Jan, thanks for the help, you are correct - it appears I needed to turn CORS support on in Node Red. Not sure why that is disabled by default. Now I can see my measurements appearing on the map, in approximately the correct location. But only approximately :frowning: However, that’s another issue I think :).