I'm using a geoJSON to display a shape in Android MapBox. In the geoJSON I've got a lot of polygons and each of them has a value in "properties" JSONObject, here is an exemple:
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
2.3303745,
39.841098
],
[
2.3303464,
39.8410976
],
[
2.3303261,
39.8411054
]
]
]
},
"type": "Feature",
"properties": {
"value": 169
}
}
I would like to fill the polygon with a specific colour according to the value.
What I currently do and get
GeoJsonSource geoJsonSource = new GeoJsonSource("geojson",stringbuilder.toString());
mapboxMap.addSource(geoJsonSource);
mapboxMap.addLayer(new FillLayer("geojson", "geojson"));
Question
What should I do to colorize the shape?
- Add in the JSON a "fill" value to "poperties" Object? (didn't work for me,yet.)
- Parse the JSON manually and use "fillColor" function in "PolygonOptions" object? (will add a lot of work, because there is a lot of polygons)