Skip to content

Instantly share code, notes, and snippets.

@jeff-hager-dev
Last active June 4, 2018 19:56
Show Gist options
  • Save jeff-hager-dev/6fb6063e8bb8070fdd318e5dfebd4b11 to your computer and use it in GitHub Desktop.
Save jeff-hager-dev/6fb6063e8bb8070fdd318e5dfebd4b11 to your computer and use it in GitHub Desktop.
[Spiderifying Clustered Layers in Mapbox-GL: Setting up supercluster] #geospark-blog-post
var createSuperClusterForLayer = function(sourceId, clusterRadius, data){
var layerSource = map.getSource(sourceId);
var scale = 8192 / layerSource.tileSize;
var cluster = new supercluster({
"radius": clusterRadius * scale,
"extent": 8192,
"maxZoom": layerSource.maxzoom - 1
});
cluster.loadData(data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment