-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed as not planned
Description
2.15.0:
Question
I'd like to change the coloring of a cluster when it contains a specific Property of a Feature.
I use the method below to change the style of a single marker.
map.setLayoutProperty(
'location-point',
'icon-image',
[
'case',
['==', ['get', 'id'], mapLocationActive],
'marker',
'marker-alt'
]
);
This works fine.
I would like to do the similar thing (distinguish active from other clusters) when my location is inside a cluster
map.addLayer({
id: 'clusters',
type: 'circle',
source: 'locations',
filter: ['has', 'point_count'],
paint: {
'circle-color': 'white',
'circle-radius': 30,
}
});
something like this but I don't know how to do the condition part
map.setPaintProperty( //EDITED AS THIS WAS setLayoutProperty( PREVIOUSLY
'clusters',
'circle-color',
[
'case',
['in', ['getClusterLeaves', 'id'], mapLocationActive], //this is wrong
'red',
'white'
],
);
Links to related documentation
https://docs.mapbox.com/mapbox-gl-js/example/cluster/
https://docs.mapbox.com/style-spec/reference/expressions/#in
https://docs.mapbox.com/mapbox-gl-js/api/sources/#geojsonsource#getclusterleaves
Metadata
Metadata
Assignees
Labels
No labels