mapbox / mapbox/mapbox-gl-leaflet
Uncaught Map has no maxZoom specified. markercluster
@w8r is already working on this.
Since Dec 5, 2019.
- Dominant language
- JavaScript
- Stars
- 546
- Forks
- 148
- PR merge metrics
- No merged PRs in 30d
Description
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);
});
}
});
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.