From a97c2615de8eebbe869ddc1d5c83cff151c5f43b Mon Sep 17 00:00:00 2001 From: Beppe Date: Mon, 9 Sep 2024 16:16:02 +0200 Subject: [PATCH] Aggiunta vista satellite su mappe --- assets/src/css/style.css | 4 ++++ modules/interventi/plugins/mappa.php | 16 ++++++++++++++++ modules/mappa/edit.php | 16 ++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/assets/src/css/style.css b/assets/src/css/style.css index e826a0310..097fee695 100755 --- a/assets/src/css/style.css +++ b/assets/src/css/style.css @@ -1630,6 +1630,10 @@ body:not(.sidebar-collapse) .sidebar .nav-treeview .nav-treeview .nav-link { background-image: url('../img/leaflet/icon-fullscreen.svg'); } +.leaflet-control-layers-toggle { + background-image: url('../img/leaflet/layers.png'); +} + /** Rimozione avviso CKEditor temporanea **/ .cke_notification_warning{ display:none !important; diff --git a/modules/interventi/plugins/mappa.php b/modules/interventi/plugins/mappa.php index c2b4d5a04..1078fb638 100644 --- a/modules/interventi/plugins/mappa.php +++ b/modules/interventi/plugins/mappa.php @@ -122,6 +122,8 @@ if (get('op') == 'getmappa') { const lt = "41.706"; const ln = "13.228"; var container = L.DomUtil.get("mappa"); + var esri_url ="https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"; + var esri_attribution = "© Esri © OpenStreetMap Contributors"; if(container._leaflet_id != null){ map.eachLayer(function (layer) { @@ -139,8 +141,22 @@ if (get('op') == 'getmappa') { L.tileLayer("", { maxZoom: 17, attribution: "© OpenStreetMap" + }); + + var street = L.tileLayer('', { + maxZoom: 17, + attribution: "© OpenStreetMap", }).addTo(map); + var satellite = L.tileLayer(esri_url, {id: "mappa", maxZoom: 17, tileSize: 512, zoomOffset: -1, attribution: esri_attribution}); + + var baseLayers = { + "Strade": street, + "Satellite": satellite + }; + + L.control.layers(baseLayers).addTo(map); + var markerArray = []; if( document.getElementById('mappa') ){ for (let i = 0; i < lng.length; i++) { diff --git a/modules/mappa/edit.php b/modules/mappa/edit.php index c4191c266..abf13f505 100644 --- a/modules/mappa/edit.php +++ b/modules/mappa/edit.php @@ -94,6 +94,8 @@ foreach ($rs_stati as $stato) { var coords = []; var circle = ""; var ROOTDIR = ''; + var esri_url ="https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"; + var esri_attribution = "© Esri © OpenStreetMap Contributors"; function caricaMappa() { const lat = "41.706"; @@ -108,7 +110,21 @@ foreach ($rs_stati as $stato) { L.tileLayer("", { maxZoom: 17, attribution: "© OpenStreetMap" + }); + + var street = L.tileLayer('', { + maxZoom: 17, + attribution: "© OpenStreetMap", }).addTo(map); + + var satellite = L.tileLayer(esri_url, {id: "mappa", maxZoom: 17, tileSize: 512, zoomOffset: -1, attribution: esri_attribution}); + + var baseLayers = { + "Strade": street, + "Satellite": satellite + }; + + L.control.layers(baseLayers).addTo(map); } function initGeocomplete() {