From 9f5c6c606d37df5274989b3312628e19cc8b2dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20P?= Date: Mon, 8 Jul 2024 10:25:19 +0200 Subject: [PATCH] Use mapbox for satellite layer --- js/gis.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/gis.js b/js/gis.js index 98ad5d4..30dae2e 100644 --- a/js/gis.js +++ b/js/gis.js @@ -2,6 +2,8 @@ import UI from "./ui.js"; +const MAPBOX_TOKEN = 'pk.eyJ1Ijoibmljb3BhIiwiYSI6ImNseWNwZjJjbjFidzcya3BoYTU0bHg4NnkifQ.3036JnCXZTEMt6jVgMzVRw'; + // Global leaflet /** * @namespace GIS @@ -155,10 +157,13 @@ GIS.initLayers = async function(map) { maxZoom: 22, attribution: '© OpenStreetMap contributors' }); - let esriSat = new L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { + 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, - attribution: '© Esri' + attribution: '© Mapbox' }); let boundaries = await this.loadLayer('confini.geojson', {}, false); let buildings = await this.loadLayer('fabbricati.geojson', optionsPaesistici, false); @@ -178,7 +183,7 @@ GIS.initLayers = async function(map) { sitesGroup.addTo(map); const baseMap = { "OpenStreetMap" : osmap, - "Satellite" : esriSat, + "Satellite" : mapbox, "Cartografia catastale" : baseCatasto, }; const archeo = {