Configure min and max zoom
This commit is contained in:
parent
13d6004fe8
commit
1067d108e5
@ -25,6 +25,9 @@ const GIS = {};
|
|||||||
|
|
||||||
GIS.CENTER_COORDS = [40.5492, 14.2317];
|
GIS.CENTER_COORDS = [40.5492, 14.2317];
|
||||||
GIS.INIT_ZOOM = 14;
|
GIS.INIT_ZOOM = 14;
|
||||||
|
GIS.MIN_ZOOM = 11;
|
||||||
|
GIS.MAX_ZOOM = 24;
|
||||||
|
|
||||||
const optionsVincoli = {
|
const optionsVincoli = {
|
||||||
color: '#222',
|
color: '#222',
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
@ -119,7 +122,7 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
|
|||||||
|
|
||||||
let map = L.map(mapId, {
|
let map = L.map(mapId, {
|
||||||
//attributionControl: false,
|
//attributionControl: false,
|
||||||
minZoom: 11,
|
minZoom: GIS.MIN_ZOOM,
|
||||||
}).setView(this.CENTER_COORDS, zoomLevel);
|
}).setView(this.CENTER_COORDS, zoomLevel);
|
||||||
|
|
||||||
map.crs = L.CRS.EPSG4326;
|
map.crs = L.CRS.EPSG4326;
|
||||||
@ -368,16 +371,16 @@ GIS.initLayers = async function(map) {
|
|||||||
layerLopozzo.id = 'lopozzo';
|
layerLopozzo.id = 'lopozzo';
|
||||||
|
|
||||||
let osmap = new L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
let osmap = new L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
maxNativeZoom : 22,
|
maxNativeZoom : GIS.MAX_ZOOM,
|
||||||
maxZoom: 22,
|
maxZoom: GIS.MAX_ZOOM,
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
attribution: '© <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}`, {
|
let mapbox = new L.tileLayer(`https://api.mapbox.com/v4/{id}/{z}/{x}/{y}@2x.jpg90?access_token=${MAPBOX_TOKEN}`, {
|
||||||
id : 'mapbox.satellite',
|
id : 'mapbox.satellite',
|
||||||
tileSize : 512,
|
tileSize : 512,
|
||||||
zoomOffset : -1,
|
zoomOffset : -1,
|
||||||
maxNativeZoom : 22,
|
maxNativeZoom : GIS.MAX_ZOOM,
|
||||||
maxZoom: 22,
|
maxZoom: GIS.MAX_ZOOM,
|
||||||
attribution: '© Mapbox'
|
attribution: '© Mapbox'
|
||||||
});
|
});
|
||||||
let boundaries = await this.loadLayer('confini.geojson', {}, false);
|
let boundaries = await this.loadLayer('confini.geojson', {}, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user