From 24cb372ca7e8792e1a6740fa4470947e8f705674 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 16 Sep 2024 14:28:26 -0700 Subject: [PATCH] Google Maps fallback option --- src/map/core/useMapStyles.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/map/core/useMapStyles.js b/src/map/core/useMapStyles.js index dd4a039cfb..d1417132f5 100644 --- a/src/map/core/useMapStyles.js +++ b/src/map/core/useMapStyles.js @@ -85,33 +85,39 @@ export default () => { id: 'googleRoad', title: t('mapGoogleRoad'), style: styleCustom({ - tiles: [`google://roadmap/{z}/{x}/{y}?key=${googleKey}`], + tiles: Boolean(googleKey) + ? [`google://roadmap/{z}/{x}/{y}?key=${googleKey}`] + : [0, 1, 2, 3].map((i) => `https://mt${i}.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}&s=Ga`), maxZoom: 20, attribution: '© Google', }), - available: Boolean(googleKey), + available: true, attribute: 'googleKey', }, { id: 'googleSatellite', title: t('mapGoogleSatellite'), style: styleCustom({ - tiles: [`google://satellite/{z}/{x}/{y}?key=${googleKey}`], + tiles: Boolean(googleKey) + ? [`google://satellite/{z}/{x}/{y}?key=${googleKey}`] + : [0, 1, 2, 3].map((i) => `https://mt${i}.google.com/vt/lyrs=s&hl=en&x={x}&y={y}&z={z}&s=Ga`), maxZoom: 20, attribution: '© Google', }), - available: Boolean(googleKey), + available: true, attribute: 'googleKey', }, { id: 'googleHybrid', title: t('mapGoogleHybrid'), style: styleCustom({ - tiles: [`google://satellite/{z}/{x}/{y}?key=${googleKey}&layerType=layerRoadmap`], + tiles: Boolean(googleKey) + ? [`google://satellite/{z}/{x}/{y}?key=${googleKey}&layerType=layerRoadmap`] + : [0, 1, 2, 3].map((i) => `https://mt${i}.google.com/vt/lyrs=y&hl=en&x={x}&y={y}&z={z}&s=Ga`), maxZoom: 20, attribution: '© Google', }), - available: Boolean(googleKey), + available: true, attribute: 'googleKey', }, {