From f4c38e1b3949b7c4748bd627768aff458e484e5c Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Mon, 19 Aug 2024 20:53:53 -0300 Subject: [PATCH] Map: add google tiles and make it default --- src/components/widgets/Map.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/widgets/Map.vue b/src/components/widgets/Map.vue index 8a277df99..3aa5dc4c4 100644 --- a/src/components/widgets/Map.vue +++ b/src/components/widgets/Map.vue @@ -161,9 +161,17 @@ const esri = L.tileLayer( { maxZoom: 19, attribution: '© Esri World Imagery' } ) +const google = L.tileLayer('http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}', { + maxZoom: 23, + subdomains: ['mt0', 'mt1', 'mt2', 'mt3'], + maxNativeZoom: 22, + attribution: '© Google Maps', +}) + const baseMaps = { 'OpenStreetMap': osm, 'Esri World Imagery': esri, + 'Google Maps': google, } // Show buttons when the mouse is over the widget @@ -190,7 +198,7 @@ watch(isMouseOver, () => { onMounted(async () => { // Bind leaflet instance to map element - map.value = L.map(mapId.value, { layers: [osm, esri], attributionControl: false }).setView( + map.value = L.map(mapId.value, { layers: [google, osm, esri], attributionControl: false }).setView( mapCenter.value as LatLngTuple, zoom.value ) as Map