What does Grafana world-map json endpoint needs to cities?

I have used worldmap plugin and I should it’s great. There are some customizations that I need to display cities from different countries. The problem is that plugin uses Countries for location data. It can be set to json endpoint, but there is no explanation what that endpoint would do and how should it return data.

In the readme there was a link for json endpoint:
https://worldping-demo.raintank.io/api/plugin-proxy/raintank-worldping-app/api/v2/probes/locations

First of all the question is that am I on the right path to display cities from around the world by using json endpoint? Does it get latitude and longitude?

The second question is what is the format that I should use for json endpoint to display required cities?

The endpoint for worldPing changed after our recent rebranding. Thanks for pointing this out - will fix it in the docs. It is now:

https://worldpingdemo.grafana.net/api/plugin-proxy/raintank-worldping-app/api/v2/probes/locations

The endpoint returns data in this format:

[
  {
    "key": "charleroi",
    "latitude": 50.411361694336,
    "longitude": 4.4444799423218,
    "name": "Charleroi"
  },
  {
    "key": "los-angeles",
    "latitude": 34.067401885986,
    "longitude": -118.24230194092,
    "name": "Los Angeles"
  },
...

Your endpoint should return json that looks similar. It matches the query against the key value.

You have to manually add latitude and longitude yourself for any cities that you want to support. Or write code that fetches the coordinates from some Google API.

Thank you very much for your response. Is there a way to give grafana the count of users on that specific lat & long? I mean when someone hover over the map he could see the count of user on the map?

The value shown on the popover is the value of the query where it matches a location in your list of locations.

For example, if I have this query in Graphite:

Then the count value is shown per country:

There is also support for geohashes if you are using ElasticSearch (and for InfluxDB if you calculate the geohashes your self).

Does that answer your question? If not, could you give me an example of what you mean.

1 Like

how can we plot based on longitude and latitude using MSSQL as the datasource?