Variables in GeoJSON Style rules

Hello everybody. I’m trying to use Geomap with GeoJSON layer which represents my area divided into smaller areas. I want to color each area based on sql query and value mapping but as I see, Style rules can only get static values (no variables and colors from value mapping). Is there any way to get coloured areas where color of each area will be based on variables from sql query and value mapping?

as you see there is fixed CLUSTER_ID and color and I need to use variable for CLUSTER_ID and color from value mapping.

1 Like

So you would like to while displaying all of them color differently based on a variable change?

Check this thread out.

Since you want it to be dynamic reading things from a local file is going to be difficult if not impossible to do styling changes.

if you serve the geojson data from an api service maybe you can use CSS styles to modify your points, line, polygons with thickness & color? Not sure if it will be picked up by grafana geomap plugin though

{ 
    "type": "Feature",
    "geometry": {
    "type": "Polygon",
    "coordinates": [[
        [-180.0, 10.0], [20.0, 90.0], [180.0, -5.0], [-30.0, -90.0]
        ]]
    },
    "style": {
        "__comment": "all SVG styles allowed",
        "fill":"red",
        "stroke-width":"3",
        "fill-opacity":0.6
    },
    "className": {
        "baseVal":"A class name"
    }
}

Also looks like someone already posted this issue