Hello,
I'm very beginner in JS and also leaflet library. I would like to if something existe to change how the zoom works. Is there a class or feature that enable to change the tileSize on zoom.
Thank you.
Hi @CallMarl, I don't know if I understand well your problem but you can change your base layer used at the beginning on zoom events. So you could switch your layer with another configured as you want.
You need:
import * as L from 'leaflet';
// map config
const mapUrl = 'YOUR_URL';
const baseLayer = L.tileLayer(mapUrl, { maxZoom: 20 });
const newMapUrl = 'YOUR_NEW_URL';
const newBaseLayer = L.tileLayer(newMapUrl, { maxZoom: 20 });
// init map
this.map = L.map('map', {
center: new L.LatLng(48.84195331838587, 2.2852662205696106),
zoom: 18,
layers: [baseLayer]
});
// zoom event
this.map.on('zoomend', () => {
this.map.removeLayer(baseLayer);
this.map.addLayer(newBaseLayer);
});
I hope it could help you.
Hi, great to hear that you find Leaflet useful!
However, this issue tracker is used for reporting bugs and discussing new features. For questions on using Leaflet, please use gis.stackexchange.com or stackoverflow.
If you are really sure that this is a bug in leaflet, or a feature request, please change the wording to make it look like a bug report.
You're probably looking for maxNativeZoom
BTW.
Most helpful comment
Hi, great to hear that you find Leaflet useful!
However, this issue tracker is used for reporting bugs and discussing new features. For questions on using Leaflet, please use gis.stackexchange.com or stackoverflow.
If you are really sure that this is a bug in leaflet, or a feature request, please change the wording to make it look like a bug report.