Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var layers = [
- [150, '#f28cb1'],
- [20, '#f1f075'],
- [0, '#51bbd6']
- ];
- layers.forEach(function(layer, i) {
- map.addLayer({
- "id": "cluster-" + i,
- "source": "markers",
- "type": "circle",
- "paint": {
- "circle-color": layer[1],
- "circle-radius": 10
- },
- "filter": i === 0 ? [">=", "point_count", layer[0]] : ["all", [">=", "point_count", layer[0]],
- ["<", "point_count", layers[i - 1][0]]
- ]
- });
- });
- map.addLayer({
- "id": "cluster-count",
- "type": "symbol",
- "source": "markers",
- "layout": {
- "text-field": "{point_count}",
- "text-font": [
- "Arial Unicode MS Bold"
- ],
- "text-size": 12,
- "icon-image": "{marker-symbol}",
- "icon-size": 0.20
- },
- "paint": {
- "text-color": "white"
- }
- });
Add Comment
Please, Sign In to add comment