From 1067d108e516b1762950b1f77e4e3c407c6c30f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20P?= Date: Fri, 28 Feb 2025 16:03:33 +0100 Subject: [PATCH] Configure min and max zoom --- webgis/js/gis.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/webgis/js/gis.js b/webgis/js/gis.js index f599d24..ad6e034 100644 --- a/webgis/js/gis.js +++ b/webgis/js/gis.js @@ -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: '© OpenStreetMap 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: '© Mapbox' }); let boundaries = await this.loadLayer('confini.geojson', {}, false);