简体   繁体   中英

mapbox.js 1.6.2 - change tileset on zoom level

var map = L.mapbox.map('map', 'wmarci.i6n42nl5',

{ center: new L.LatLng(38.8929,-100.0252), zoom: 4, minZoom: 0, maxZoom: 18, layers: [ L.tileLayer('wmarci.k300ifal', { maxZoom: 13, minZoom: 5, }) ] });

This doesn't seem to be working.... ideas? Am I calling the tilelayer wrong?

something like this, use a tileLayer (defined earlier) and turn it off and on based on zoom level...

map.on('zoomend load ready', function() {
    if (map.getZoom() < 16) {
        map.removeLayer(zoomedinmap);
    } else {
        map.addLayer(zoomedinmap);
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM