Configure min and max zoom

This commit is contained in:
Nicolò P 2025-02-28 16:03:33 +01:00
parent 13d6004fe8
commit 1067d108e5

View File

@ -25,6 +25,9 @@ const GIS = {};
GIS.CENTER_COORDS = [40.5492, 14.2317];
GIS.INIT_ZOOM = 14;
GIS.MIN_ZOOM = 11;
GIS.MAX_ZOOM = 24;
const optionsVincoli = {
color: '#222',
opacity: 0.8,
@ -119,7 +122,7 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
let map = L.map(mapId, {
//attributionControl: false,
minZoom: 11,
minZoom: GIS.MIN_ZOOM,
}).setView(this.CENTER_COORDS, zoomLevel);
map.crs = L.CRS.EPSG4326;
@ -368,16 +371,16 @@ GIS.initLayers = async function(map) {
layerLopozzo.id = 'lopozzo';
let osmap = new L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxNativeZoom : 22,
maxZoom: 22,
maxNativeZoom : GIS.MAX_ZOOM,
maxZoom: GIS.MAX_ZOOM,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
});
let mapbox = new L.tileLayer(`https://api.mapbox.com/v4/{id}/{z}/{x}/{y}@2x.jpg90?access_token=${MAPBOX_TOKEN}`, {
id : 'mapbox.satellite',
tileSize : 512,
zoomOffset : -1,
maxNativeZoom : 22,
maxZoom: 22,
maxNativeZoom : GIS.MAX_ZOOM,
maxZoom: GIS.MAX_ZOOM,
attribution: '&copy; Mapbox'
});
let boundaries = await this.loadLayer('confini.geojson', {}, false);