Uncaught Map has no maxZoom specified. markercluster
dmis53 opened this issue · 1 comments
dmis53 commented
If I first build markers in a cluster group on a different tile, and therefore switch to MapBox GL, everything is fine. But if you turn on MapBox GL first and then add a cluster to the group, then I fall into the error: "Uncaught Map has no maxZoom specified"
I added MapBox GL to my tile list:
createMapBoxGlLayer: function () {
return L.mapboxGL({
accessToken: 'my-token',
style: 'mapbox://styles/mapbox/light-v10'
});
},
My baselayerchange event:
leafletMap.on('baselayerchange', function(tile){
if (tile.name === 'My Tile Name') {
var map = tile.layer._glMap;
map.on('load', function () {
var layers = map.getStyle().layers;
var labelLayerId;
for (var i = 0; i < layers.length; i++) {
if (layers[i].type === 'symbol' && layers[i].layout['text-field']) {
labelLayerId = layers[i].id;
break;
}
}
map.addLayer({
'id': '3d-buildings',
'source': 'composite',
'source-layer': 'building',
'filter': ['==', 'extrude', 'true'],
'type': 'fill-extrusion',
'minzoom': 15,
'paint': {
'fill-extrusion-color': '#bfbcbf',
'fill-extrusion-height': [
"interpolate", ["linear"], ["zoom"],
15, 0,
15.05, ["get", "height"]
],
'fill-extrusion-base': [
"interpolate", ["linear"], ["zoom"],
15, 0,
15.05, ["get", "min_height"]
],
'fill-extrusion-opacity': .6
}
}, labelLayerId);
});
}
});
bpatrik commented
It seems to be related to: Leaflet/Leaflet.markercluster#611