diff --git a/docs/customization.md b/docs/customization.md index 0776b5c13..420939484 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -57,7 +57,6 @@ In json files, you can just override the primary keys you need. You have to over - You can also update the map layers. There are two map layers available: - `mapClassicLayerUrl` for the map version - - `mapClassicLayerUrlOffline` for the map version in offline mode (if not defined `mapClassicLayerUrl` will be used in offline mode) - `mapSatelliteLayerUrl` for the satellite version. It is optional, so if you want to have only one available map background, you can add `mapSatelliteLayerUrl: undefined`. This will remove the button which allows the user to switch between two map backgrounds. - `zoomAvailableOffline` allows you to define the zoom modes allowed in offline mode. This allows you to control the amount of disk space required when caching. Default `[13,14,15]` diff --git a/frontend/config/map.json b/frontend/config/map.json index c228c83f9..a7e371bff 100644 --- a/frontend/config/map.json +++ b/frontend/config/map.json @@ -4,7 +4,6 @@ "searchMapZoom": 10, "mapCredits": "OpenTopoMap", "mapClassicLayerUrl": "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", - "mapClassicLayerUrlOffline": "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", "mapSatelliteLayerUrl": "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", "zoomAvailableOffline": [13, 14, 15] } diff --git a/frontend/src/components/Map/interface.ts b/frontend/src/components/Map/interface.ts index 4bfdfeaa9..6c6445152 100644 --- a/frontend/src/components/Map/interface.ts +++ b/frontend/src/components/Map/interface.ts @@ -4,7 +4,6 @@ export interface MapConfig { searchMapZoom: number; mapCredits: string; mapClassicLayerUrl: string; - mapClassicLayerUrlOffline?: string; mapSatelliteLayerUrl?: string; zoomAvailableOffline?: number[]; } diff --git a/frontend/src/services/offline/injectOfflineMode.ts b/frontend/src/services/offline/injectOfflineMode.ts index 625fec8ac..9dd205de7 100644 --- a/frontend/src/services/offline/injectOfflineMode.ts +++ b/frontend/src/services/offline/injectOfflineMode.ts @@ -7,13 +7,9 @@ const LeafletOffline = require('leaflet.offline'); const injectOfflineMode = (map: Map, id: number, center: LatLngBoundsExpression) => { const mapConfig = getMapConfig(); - let mapTilesUrl; - if (navigator.onLine) mapTilesUrl = mapConfig.mapClassicLayerUrl; - else mapTilesUrl = mapConfig.mapClassicLayerUrlOffline ?? mapConfig.mapClassicLayerUrl; - const tileLayerOffline = L.tileLayer // @ts-ignore no type available in this plugin - .offline(`${mapTilesUrl}?${id}`, { + .offline(`${mapConfig.mapClassicLayerUrl}?${id}`, { attribution: 'Map data {attribution.OpenStreetMap}', subdomains: 'abc', minZoom: Math.min(...(mapConfig?.zoomAvailableOffline ?? [])),