I am using CartoDB.js (3.15.9, based on Leaflet.js) with two map base layers, a street layer from CartoDB and a satellite layer from MapQuest:
var options = {
center: [53.2, -2.0],
zoom: 6
};
var map = new L.Map('map', options);
var streetLayer = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors</a>'
}).addTo(map);
L.control.layers({
'Map': streetLayer,
'Satellite': MQ.satelliteLayer()
}, null, {'collapsed': false, 'position': 'bottomleft'}).addTo(map);
Can I set per-layer max zoom levels? I would like a max zoom of 18 on the street layer, and 21 on the satellite layer (this is because they have different max zoom levels available).
I tried setting maxZoom: 18
on the streetLayer
object, but this doesn't seem to do anything. The same option on options
sets a global maximum zoom, but that obviously isn't what I want.