I am using mapbox clustering to cluster a large set of features, this is the current layer object:
{
id: 'markerclusters',
type: 'circle',
source: 'markers',
filter: ['has', 'point_count'],
paint: {
'circle-color': ['step', ['get', 'point_count'], '#d11507', 10, '#a51b0b', 20, '#7a1b0c'],
'circle-radius': ['step', ['get', 'point_count'], 20, 10, 30, 20, 40] }
The features on the map all have an id property and the user can search by keyword to highlight one or more features. That will give me an array of features and I would like to highlight the markers and the clusters that include them. It already works fine for the markers by setting the layout property to this:
'icon-color', ['case', ['in', ['get', 'id'], ['literal', highlightedFeatures]], '#AAFB23', '#000000']
But I'm unsure how to do this for the clusters. As far as I can tell there's no API to get the features of a cluster, so I thought about the possibility to create a custom cluster property containing the feature ids, but I haven't found any operator that could build an array in the layer expressions of mapbox. And not just that, there also doesn't seem to be any operator to check if two arrays intersect, so I'm unsure what to do here...
Any ideas are appreciated!