as you can see, geojson contains only maps. We have thousands of maps and thousands of columns, we can’t create a specific geojson for every data to represent.
Approach #1
Have you looked at the option of importing these geojson files into postgres and enabling postgis? That would be the cleanest approach I would recommend.
Approach #2
Write a simple node/express rest api that reads these geojson files and provide the url to grafana. But not sure if you get new geojson data dynamically or you always have a static list
app.get('/geo', (req, res) => {
let rawdata = fs.readFileSync('./data/earthquakes.geojson');
let geo = JSON.parse(rawdata);
return res.json(geo)
})
I think it might be best to review your architectural approach to this whole thing. You have data scattered in a few places. They need to be centralized. you already have postgres so I would highly recommend you have it centralized there.
Thank you for your very precious suggestions.
I am new to Grafana: where do I have to put code fragments in order to create these web services as you did?
Ok, so I have to use an external software to realize a web service. There isn’t a way to do only with Grafana.
Fine, I understand. Thank you for the very complete lesson!
ehm, at the moment 2400 and counting. Every year in Italy some territory changes, and we have to represent data for over 25 years in at least 5 levels of detail, from Country to village.
I think your solution is very elegant for automated software, but difficult to let it use to my users. In Superset they choose maps, fields and values in a very simple way when they have to create a single map.
It looks like grafana can only create area objects from geojson static files and not from a query that returns geojson (or any geometry data). It can only work with lat/lon, geohash or lookup (but also returning lat/log)
Grafana only uses static geojson files. They can use formatting rules but those rules does not lookup any data from queries. I didn’t test but the screenshot shown here suggests that variables can be used (although the complexity will grow fast). However, without a way to use query data to setup the style, it cannot be used to represent data.
As a suggestion for grafana, I would say that we need a new layer type similar to “Markers” or “Heatmap” (or improve the existing geojson one), but with geometry where it uses lat/lon/hash/lookup.
Thanks, @yosiasz ! It does work. However, it still needs some polishing:
with geometry as a field, we do need some way to customize the popup dialog. The polygon I’m using is a little bit large and it covers the screen. The plugin github shows a “Properties” field after the “Pop up Time”, but in my case, it is missing. (It looks like I’m using the latest 1.4.4 version)
the shape border is not configurable. I tried to use the mark size but it looks like it is a fixed value.
Value mappings can set a color but the map ignores it.
This is just a partial screenshot to illustrate my panel: