Last active
June 4, 2018 19:56
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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