Colour clusters based on an alternative aggregation value #4266
Unanswered
IlariaCallegari
asked this question in
Q&A
Replies: 1 comment 1 reply
-
You should be able to use maplibre-gl-js/src/source/geojson_source.ts Line 184 in 5093bf4 See the following example: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! 👋🏻
I have been working on this issue for quite a while and could not find a way to solve this.
I am using the clustering functionality and wondering how can I colour the clusters based on a custom aggregated property - in my case the
net_exposure
- of the underlying points, instead of thepoint_count
property?I've tried passing
net_exposure
in the GeoJSON properties, but I'm unable to access it within the case expression in the style layer for setting the cluster colours, as it seems that the GeoJSON properties get lost in the clustering process.Ideally, I'd like to be able to aggregate the
net_exposure
while clustering and then use the aggregated value to determine the colour of each cluster.Here's a simplified version of my code - I use react-map-gl:
As for the example above, in the circle-color expression, I'd like to use the accumulated
net_exposure
to colour my clusters instead ofpoint_count
. Is there a way to achieve this? Or would it be possible to add a second aggregation value to the clusters that can then be retrieved in the style layer?Just to be extra clear - what I am looking at is that the clustering gets performed based on radius/proximity as it is done currently, but then, under the hood, there is also another property that can be set, if required, that gets aggregated whilst the main clustering happens.
Apologies if this question had already been answered somewhere else. I probably missed the discussion during my search.
Thanks!
Ilaria
Beta Was this translation helpful? Give feedback.
All reactions