Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Map has no maxZoom specified. markercluster #113

Open
dmis53 opened this issue Nov 13, 2019 · 1 comment
Open

Uncaught Map has no maxZoom specified. markercluster #113

dmis53 opened this issue Nov 13, 2019 · 1 comment
Assignees

Comments

@dmis53
Copy link

dmis53 commented Nov 13, 2019

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);
                });
            }
        });
@w8r w8r self-assigned this Dec 5, 2019
@bpatrik
Copy link

bpatrik commented Apr 30, 2021

It seems to be related to: Leaflet/Leaflet.markercluster#611

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants