Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jeff-hager-dev/2b4edd0578e19a3e9e2a3af7d4b5fe89 to your computer and use it in GitHub Desktop.
Save jeff-hager-dev/2b4edd0578e19a3e9e2a3af7d4b5fe89 to your computer and use it in GitHub Desktop.
[Spiderifying Clustered Layers in Mapbox-GL: Pulling data from the Clustered feature] #geospark-blog-post
//Example of a function for getting all features in a current cluster
var getFeaturesFromCluster = function(mapZoom, sourceId, clusterId){
var sourceCluster = layerClusters[sourceId]; // Objected holding all superclusters instances keyed off source id
var zoomLevel = Math.floor(mapZoom); // current zoom level
return sourceCluster.getLeaves(clusterId, zoomLevel, Infinity);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment