diff --git a/client/src/components/Map/MapViewAuto.offline.test.tsx b/client/src/components/Map/MapViewAuto.offline.test.tsx
new file mode 100644
index 000000000..885aef6d1
--- /dev/null
+++ b/client/src/components/Map/MapViewAuto.offline.test.tsx
@@ -0,0 +1,123 @@
+/**
+ * The trip map offline (FE-COMP-MAPAUTO-OFFLINE-*).
+ *
+ * Whatever basemap the user picked, offline the map never goes grey: a basemap
+ * with nothing stored switches to the stored OpenFreeMap one, with the same
+ * markers and routes, and says so.
+ */
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { render, screen } from '../../../tests/helpers/render';
+import { resetAllStores, seedStore } from '../../../tests/helpers/store';
+import { OFM_DARK, OFM_POSITRON } from '../../constants/mapDefaults';
+import { useSettingsStore } from '../../store/settingsStore';
+import { resetWebGLProbe } from '../../utils/webgl';
+import { MapViewAuto } from './MapViewAuto';
+
+const env = vi.hoisted(() => ({ offline: false, dark: false }));
+const seen = vi.hoisted(() => ({
+ leaflet: null as null | { tileUrl?: string },
+ gl: null as null | { engine: string; glProvider?: string; styleOverride?: string },
+}));
+
+vi.mock('./MapView', () => ({
+ MapView: (props: { tileUrl?: string }) => {
+ seen.leaflet = props;
+ return
;
+ },
+}));
+vi.mock('./glLazy', () => ({
+ MapViewGLMaplibre: (props: { glProvider?: string; styleOverride?: string }) => {
+ seen.gl = { engine: 'maplibre', ...props };
+ return ;
+ },
+ MapViewGLMapbox: (props: { glProvider?: string; styleOverride?: string }) => {
+ seen.gl = { engine: 'mapbox', ...props };
+ return ;
+ },
+}));
+vi.mock('./useRoadtripHazards', () => ({ useRoadtripHazards: () => ({ feed: null }) }));
+vi.mock('../../hooks/useNetworkMode', () => ({
+ useNetworkMode: () => ({ offline: env.offline, forced: false, setForced: () => {} }),
+}));
+vi.mock('../../hooks/useIsDark', () => ({ useIsDark: () => env.dark }));
+vi.mock('../../native/platform', async (importOriginal) => ({
+ ...(await importOriginal()),
+ isNativeIos: () => false,
+}));
+
+const realGetContext = HTMLCanvasElement.prototype.getContext;
+
+beforeEach(() => {
+ resetAllStores();
+ resetWebGLProbe();
+ env.offline = false;
+ env.dark = false;
+ seen.leaflet = null;
+ seen.gl = null;
+ const ctx = { getExtension: () => ({ loseContext: () => {} }) };
+ HTMLCanvasElement.prototype.getContext = vi.fn((type: string) =>
+ type === 'webgl2' ? ctx : null
+ ) as unknown as typeof realGetContext;
+});
+
+afterEach(() => {
+ HTMLCanvasElement.prototype.getContext = realGetContext;
+ resetWebGLProbe();
+});
+
+const pill = () => screen.queryByRole('status');
+
+describe('MapViewAuto offline', () => {
+ it('FE-COMP-MAPAUTO-OFFLINE-001: a Mapbox map online stays Mapbox, with no pill', async () => {
+ seedStore(useSettingsStore, { settings: { map_provider: 'mapbox-gl', mapbox_access_token: 'pk.test' } });
+
+ render();
+
+ await screen.findByTestId('gl-map');
+ expect(seen.gl).toMatchObject({ engine: 'mapbox', glProvider: 'mapbox-gl', styleOverride: undefined });
+ expect(pill()).not.toBeInTheDocument();
+ });
+
+ it('FE-COMP-MAPAUTO-OFFLINE-002: offline, a Mapbox map draws the stored basemap with MapLibre and says so', async () => {
+ seedStore(useSettingsStore, { settings: { map_provider: 'mapbox-gl', mapbox_access_token: 'pk.test' } });
+ env.offline = true;
+ env.dark = true;
+
+ render();
+
+ await screen.findByTestId('gl-map');
+ expect(seen.gl).toMatchObject({ engine: 'maplibre', glProvider: 'maplibre-gl', styleOverride: OFM_DARK });
+ expect(pill()).toBeInTheDocument();
+ });
+
+ it('FE-COMP-MAPAUTO-OFFLINE-003: a MapLibre map already on a stored style stays as it is', async () => {
+ seedStore(useSettingsStore, { settings: { map_provider: 'maplibre-gl', maplibre_style: OFM_POSITRON } });
+ env.offline = true;
+
+ render();
+
+ await screen.findByTestId('gl-map');
+ expect(seen.gl?.styleOverride).toBeUndefined();
+ expect(pill()).not.toBeInTheDocument();
+ });
+
+ it('FE-COMP-MAPAUTO-OFFLINE-004: offline, Leaflet on OpenStreetMap tiles switches to the stored basemap', () => {
+ seedStore(useSettingsStore, { settings: { map_provider: 'leaflet' } });
+ env.offline = true;
+
+ render();
+
+ expect(seen.leaflet?.tileUrl).toBe(OFM_POSITRON);
+ expect(pill()).toBeInTheDocument();
+ });
+
+ it('FE-COMP-MAPAUTO-OFFLINE-005: offline, a raster template the service worker stored stays', () => {
+ seedStore(useSettingsStore, { settings: { map_provider: 'leaflet' } });
+ env.offline = true;
+
+ render();
+
+ expect(seen.leaflet?.tileUrl).toBe('https://tiles.example.com/{z}/{x}/{y}.png');
+ expect(pill()).not.toBeInTheDocument();
+ });
+});
diff --git a/client/src/components/Map/MapViewAuto.tsx b/client/src/components/Map/MapViewAuto.tsx
index 28d670417..878334835 100644
--- a/client/src/components/Map/MapViewAuto.tsx
+++ b/client/src/components/Map/MapViewAuto.tsx
@@ -1,5 +1,5 @@
import { Suspense } from 'react'
-import { AlertTriangle, Clock, Info } from 'lucide-react'
+import { AlertTriangle, Clock, CloudOff, Info } from 'lucide-react'
import { Tooltip } from '../shared/Tooltip'
import { useSettingsStore } from '../../store/settingsStore'
import { MapView } from './MapView'
@@ -9,15 +9,21 @@ import { useGlRenderer } from './glSupport'
import { useRoadtripHazards } from './useRoadtripHazards'
import { useTranslation } from '../../i18n/TranslationContext'
import type { MapViewAutoProps, MapViewProps } from './mapViewContract'
+import { useNetworkMode } from '../../hooks/useNetworkMode'
+import { useIsDark } from '../../hooks/useIsDark'
+import { OFM_POSITRON } from '../../constants/mapDefaults'
+import { glWorksOffline, leafletWorksOffline, offlineStyleFor } from './offlineBasemap'
// Auto-selects the map renderer based on user settings. Keeps the existing
// Leaflet MapView untouched so the Mapbox GL variant can mature iteratively
// behind a toggle. Atlas is not affected — it imports Leaflet directly.
//
-// Offline maps: only the Leaflet renderer supports full pre-download (raster
-// tiles via sync/tilePrefetcher.ts). GL maps are best-effort offline — their
-// vector tiles are cached opportunistically by the Service Worker as you view
-// them online (see the GL tile rules in vite.config.js), not prefetched.
+// Offline maps: "prepare for offline" stores the OpenFreeMap basemap for every
+// trip, whatever the provider (sync/tilePrefetcher.ts). Offline, a map whose own
+// basemap cannot be drawn from storage (Mapbox, another OpenFreeMap style, a
+// raster template the device cannot serve) switches to that stored basemap,
+// with the same markers, routes and tracks, and says so with a small pill. It
+// switches back once the connection returns. See offlineBasemap.ts.
export function MapViewAuto(props: MapViewAutoProps) {
const { t } = useTranslation()
const hazards = useRoadtripHazards(props.tripId, !!props.clusterLoosely)
@@ -32,7 +38,17 @@ export function MapViewAuto(props: MapViewAutoProps) {
// Fall back to Leaflet when Mapbox is selected but no token is set, or when the
// browser has no WebGL2 (both GL engines need it), so the trip planner never
// shows an empty map or one that fails to start.
- const glProvider = useGlRenderer(provider, token)
+ const configuredGl = useGlRenderer(provider, token)
+ const maplibreStyle = useSettingsStore(s => s.settings.maplibre_style)
+ const { offline } = useNetworkMode()
+ const dark = useIsDark()
+ const offlineStyle = offlineStyleFor(dark)
+ // Offline on a basemap that has nothing stored: draw the stored one with MapLibre.
+ const glFallback = !!configuredGl && offline && !glWorksOffline(configuredGl, maplibreStyle)
+ const glProvider = glFallback ? 'maplibre-gl' : configuredGl
+ const leafletFallback = !configuredGl && offline && !leafletWorksOffline(mapProps.tileUrl ?? OFM_POSITRON)
+ if (leafletFallback) mapProps.tileUrl = offlineStyle
+ const pill = (glFallback || leafletFallback) &&
// One chunk per engine: picking the binding here is what keeps mapbox-gl and
// maplibre-gl out of each other's downloads.
const MapViewGL = glProvider === 'maplibre-gl' ? MapViewGLMaplibre : MapViewGLMapbox
@@ -45,12 +61,33 @@ export function MapViewAuto(props: MapViewAutoProps) {
// to Leaflet keeps a usable map instead of an error card.
// resetKeys: with two engine chunks, a failure under one provider must not
// keep showing Leaflet after the user switches to the other.
- }>
- }>
-
-
-
+ <>
+ }>
+ }>
+
+
+
+ {pill}
+ >
)
}
- return
+ return (
+ <>
+
+ {pill}
+ >
+ )
+}
+
+/** Says the map on screen is the stored offline basemap, not the user's own. */
+function OfflineBasemapPill({ label }: { label: string }) {
+ return (
+
+
+ {label}
+
+ )
}
diff --git a/client/src/components/Map/MapViewGL.tsx b/client/src/components/Map/MapViewGL.tsx
index 9ccae95f7..95402c9ed 100644
--- a/client/src/components/Map/MapViewGL.tsx
+++ b/client/src/components/Map/MapViewGL.tsx
@@ -100,6 +100,8 @@ const NO_DAYS: Day[] = []
/** The GL renderer: the shared map contract plus the engine it is bound to. */
interface Props extends MapViewProps {
glProvider?: GlMapProvider
+ /** Draws this style instead of the user's: the offline basemap (offlineBasemap.ts). */
+ styleOverride?: string
/**
* The GL engine, injected instead of imported. Both SDKs used to be pulled in
* statically here, so a single 2.8 MB chunk carried mapbox-gl and maplibre-gl
@@ -482,6 +484,7 @@ export function MapViewGL({
onRemoveVia,
onViewportChange,
glProvider = 'mapbox-gl',
+ styleOverride,
gl,
onMapReady,
...assistant
@@ -506,7 +509,7 @@ export function MapViewGL({
const showEndpointLabels = useSettingsStore(s => s.settings.map_booking_labels) === true
const mapLang = useSettingsStore(s => s.settings.language)
const isMapLibre = glProvider === 'maplibre-gl'
- const glStyle = styleForActiveProvider(glProvider, rawMapboxStyle, rawMaplibreStyle)
+ const glStyle = styleOverride ?? styleForActiveProvider(glProvider, rawMapboxStyle, rawMaplibreStyle)
const enableMapbox3d = !isMapLibre && mapbox3d
const [mapReady, setMapReady] = useState(false)
const [readyMap, setReadyMap] = useState(null) // the ready map, read without touching mapRef
diff --git a/client/src/components/Map/offlineBasemap.test.ts b/client/src/components/Map/offlineBasemap.test.ts
new file mode 100644
index 000000000..3901fe722
--- /dev/null
+++ b/client/src/components/Map/offlineBasemap.test.ts
@@ -0,0 +1,33 @@
+import { describe, expect, it } from 'vitest';
+import { OFM_DARK, OFM_POSITRON } from '../../constants/mapDefaults';
+import { glWorksOffline, isOfflineForbiddenTemplate, leafletWorksOffline, offlineStyleFor } from './offlineBasemap';
+
+describe('offlineBasemap', () => {
+ it('picks the stored style for the colour scheme', () => {
+ expect(offlineStyleFor(false)).toBe(OFM_POSITRON);
+ expect(offlineStyleFor(true)).toBe(OFM_DARK);
+ });
+
+ it('knows OpenStreetMap standard tiles may not be stored, sharded or not', () => {
+ expect(isOfflineForbiddenTemplate('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png')).toBe(true);
+ expect(isOfflineForbiddenTemplate('https://tile.openstreetmap.org/{z}/{x}/{y}.png')).toBe(true);
+ expect(isOfflineForbiddenTemplate('https://tile.openstreetmap.de/{z}/{x}/{y}.png')).toBe(false);
+ expect(isOfflineForbiddenTemplate('not a url')).toBe(false);
+ });
+
+ it('lets only MapLibre on a stored style draw offline as configured', () => {
+ expect(glWorksOffline('maplibre-gl', OFM_POSITRON)).toBe(true);
+ expect(glWorksOffline('maplibre-gl', OFM_DARK)).toBe(true);
+ // The default MapLibre style is Liberty, whose sprite and glyphs are not stored.
+ expect(glWorksOffline('maplibre-gl', '')).toBe(false);
+ expect(glWorksOffline('mapbox-gl', OFM_POSITRON)).toBe(false);
+ });
+
+ it('keeps a stored raster template on the web, never in the iOS app or for OSM', () => {
+ expect(leafletWorksOffline(OFM_POSITRON, true)).toBe(true);
+ expect(leafletWorksOffline('https://tiles.openfreemap.org/styles/liberty', false)).toBe(false);
+ expect(leafletWorksOffline('https://tiles.example.com/{z}/{x}/{y}.png', false)).toBe(true);
+ expect(leafletWorksOffline('https://tiles.example.com/{z}/{x}/{y}.png', true)).toBe(false);
+ expect(leafletWorksOffline('https://tile.openstreetmap.org/{z}/{x}/{y}.png', false)).toBe(false);
+ });
+});
diff --git a/client/src/components/Map/offlineBasemap.ts b/client/src/components/Map/offlineBasemap.ts
new file mode 100644
index 000000000..a89b59099
--- /dev/null
+++ b/client/src/components/Map/offlineBasemap.ts
@@ -0,0 +1,54 @@
+import { OFM_DARK, OFM_POSITRON } from '../../constants/mapDefaults';
+import { isNativeIos } from '../../native/platform';
+import { isVectorStyle } from '../../utils/tileUrl';
+import { normalizeStyleForProvider, type GlMapProvider } from './glProviders';
+
+/**
+ * The basemap a map falls back to offline, so that whatever the user picked
+ * online (Mapbox, a raster template, another OpenFreeMap style) they never
+ * face a grey map once the connection goes.
+ *
+ * The two OpenFreeMap styles below are the ones "prepare for offline" stores
+ * for every trip, whatever the configured provider (sync/tilePrefetcher.ts):
+ * both share one planet tile set, so the dark one only adds its style, sprite
+ * and glyphs. A fallback has to be exactly a style that was stored, or its
+ * sprite and labels are missing offline.
+ */
+export const OFFLINE_STYLES: readonly string[] = [OFM_POSITRON, OFM_DARK];
+
+/** The stored style that matches the colour scheme. */
+export function offlineStyleFor(dark: boolean): string {
+ return dark ? OFM_DARK : OFM_POSITRON;
+}
+
+/** Hosts whose tiles may not be stored for offline use at all (OSM tile usage policy). */
+const NO_OFFLINE_HOSTS = ['tile.openstreetmap.org'];
+
+export function isOfflineForbiddenTemplate(template: string): boolean {
+ try {
+ const host = new URL(template.replace(/\{s\}/g, 'a')).hostname;
+ return NO_OFFLINE_HOSTS.some((h) => host === h || host.endsWith(`.${h}`));
+ } catch {
+ return false;
+ }
+}
+
+/**
+ * Whether a GL map can be drawn offline as configured. Only MapLibre on one of
+ * the stored styles can: Mapbox has nothing stored to draw from, and another
+ * OpenFreeMap style lacks its sprite and glyphs offline.
+ */
+export function glWorksOffline(provider: GlMapProvider, maplibreStyle: string | null | undefined): boolean {
+ return provider === 'maplibre-gl' && OFFLINE_STYLES.includes(normalizeStyleForProvider('maplibre-gl', maplibreStyle));
+}
+
+/**
+ * Whether the Leaflet map's basemap can be drawn offline as configured. A
+ * stored vector style can. A raster template can where the service worker
+ * serves the prefetched tiles, which the iOS app's WebView does not run for a
+ * self-hosted server, and never for a host whose tiles may not be stored.
+ */
+export function leafletWorksOffline(tileUrl: string, nativeIos: boolean = isNativeIos()): boolean {
+ if (isVectorStyle(tileUrl)) return OFFLINE_STYLES.includes(tileUrl);
+ return !nativeIos && !isOfflineForbiddenTemplate(tileUrl);
+}
diff --git a/client/src/sync/glPrefetcher.ts b/client/src/sync/glPrefetcher.ts
index be9e0090b..5ce99624e 100644
--- a/client/src/sync/glPrefetcher.ts
+++ b/client/src/sync/glPrefetcher.ts
@@ -25,8 +25,15 @@ const VECTOR_MAX_ZOOM = 14
// The low zooms cost a few dozen tiles at most.
const VECTOR_MIN_ZOOM = 0
-/** Requests in flight, kept low for the same reason the raster side keeps it low. */
-const CONCURRENCY = 6
+/**
+ * Requests in flight. OpenFreeMap allows offline downloads with at most four
+ * parallel requests, at most 3000 tiles and at most 50 MB each
+ * (openfreemap.org/tos), so the run keeps under all three.
+ */
+const CONCURRENCY = 4
+
+/** Byte budget per run, the 50 MB OpenFreeMap allows for one download. */
+const MAX_RUN_BYTES = 50 * 1024 * 1024
/**
* Hard cap on vector tiles per run. Each is far larger than a raster tile but
@@ -38,12 +45,52 @@ const MAX_VECTOR_TILES = 2000
export const VECTOR_CACHE = 'gl-map-offline'
/**
- * Latin glyph ranges. A label needs the range its codepoints fall in, and Latin
- * text lives in the first few; asking for all 256 ranges would download megabytes
- * of CJK nobody on this map is going to render.
+ * Glyph ranges every map needs: Latin, Greek, Cyrillic, Hebrew, Arabic and the
+ * punctuation blocks. A label needs the range its codepoints fall in; asking for
+ * all 256 ranges would download megabytes of scripts nobody on this map renders.
*/
const GLYPH_RANGES = ['0-255', '256-511', '512-767', '768-1023', '1024-1279', '1280-1535', '1536-1791', '8192-8447', '8448-8703']
+/** One range string per 256 codepoints from `from` up to `to`. */
+function rangesBetween(from: number, to: number): string[] {
+ const out: string[] = []
+ for (let start = from - (from % 256); start <= to; start += 256) out.push(`${start}-${start + 255}`)
+ return out
+}
+
+/**
+ * Scripts whose labels a trip in that part of the world shows in the local
+ * name, so a trip there gets their ranges too, or its labels render blank
+ * offline. Boxes are generous [minLng, minLat, maxLng, maxLat].
+ */
+const REGIONAL_GLYPHS: { box: [number, number, number, number]; ranges: string[] }[] = [
+ // China, Japan, Korea, Taiwan: kana and CJK punctuation, unified ideographs, Hangul, full-width forms.
+ {
+ box: [73, 18, 146, 54],
+ ranges: [...rangesBetween(0x3000, 0x30ff), ...rangesBetween(0x4e00, 0x9fff), ...rangesBetween(0xac00, 0xd7af), ...rangesBetween(0xff00, 0xffef)],
+ },
+ // Thailand, Laos, Cambodia, Myanmar.
+ { box: [92, 5, 110, 28], ranges: rangesBetween(0x0e00, 0x0eff).concat(rangesBetween(0x1000, 0x109f), rangesBetween(0x1780, 0x17ff)) },
+ // India, Nepal, Bangladesh, Sri Lanka: Devanagari through Malayalam, Sinhala.
+ { box: [60, 5, 98, 36], ranges: rangesBetween(0x0900, 0x0dff) },
+ // Georgia and Armenia.
+ { box: [39, 38, 47, 44], ranges: rangesBetween(0x0530, 0x058f).concat(rangesBetween(0x10a0, 0x10ff)) },
+ // Ethiopia and Eritrea.
+ { box: [33, 3, 48, 18], ranges: rangesBetween(0x1200, 0x139f) },
+]
+
+/** The glyph ranges a map of `bbox` needs: the common ones plus its region's scripts. */
+export function glyphRangesFor(bbox: TileBbox | null): string[] {
+ const out = new Set(GLYPH_RANGES)
+ if (bbox) {
+ for (const { box, ranges } of REGIONAL_GLYPHS) {
+ const overlaps = bbox.minLng <= box[2] && bbox.maxLng >= box[0] && bbox.minLat <= box[3] && bbox.maxLat >= box[1]
+ if (overlaps) for (const r of ranges) out.add(r)
+ }
+ }
+ return [...out]
+}
+
interface StyleSource {
type?: string
url?: string
@@ -96,15 +143,18 @@ function fontStacks(style: StyleDoc): string[] {
* the Service Worker's handler, so a repeated or resumed run over a warm cache
* costs almost nothing. Same reasoning as the raster side.
*/
-async function warm(cache: Cache | null, url: string): Promise {
+async function warm(cache: Cache | null, url: string): Promise {
try {
- if (cache && (await cache.match(url))) return false
+ if (cache && (await cache.match(url))) return 0
const res = await fetch(url, { mode: 'cors' })
- if (!res.ok) return false
- await cache?.put(url, res.clone())
- return true
+ if (!res.ok) return 0
+ // The length header when the server sends one; otherwise the body itself.
+ const header = Number(res.headers.get('content-length'))
+ const size = header > 0 ? header : (await res.clone().blob()).size || 1
+ await cache?.put(url, res)
+ return size
} catch {
- return false
+ return 0
}
}
@@ -178,11 +228,11 @@ async function readTileSources(style: StyleDoc, cache: Cache | null): Promise {
- return (await prefetchStyle(styleUrl))?.[0]?.template ?? null
+export async function prefetchStyleAssets(styleUrl: string, bbox: TileBbox | null = null): Promise {
+ return (await prefetchStyle(styleUrl, bbox))?.[0]?.template ?? null
}
-async function prefetchStyle(styleUrl: string): Promise {
+async function prefetchStyle(styleUrl: string, bbox: TileBbox | null = null): Promise {
const cache = await openVectorCache()
const style = await fetchJson(styleUrl)
if (!style) return null
@@ -199,14 +249,14 @@ async function prefetchStyle(styleUrl: string): Promise {
}
if (style.glyphs) {
- const stacks = fontStacks(style)
- await Promise.all(
- stacks.flatMap(stack =>
- GLYPH_RANGES.map(range =>
- warm(cache, style.glyphs!.replace('{fontstack}', encodeURIComponent(stack)).replace('{range}', range)),
- ),
+ // Through the same pool as the tiles: a trip in East Asia asks for a few
+ // hundred glyph ranges, and OpenFreeMap allows four requests at a time.
+ const urls = fontStacks(style).flatMap(stack =>
+ glyphRangesFor(bbox).map(range =>
+ style.glyphs!.replace('{fontstack}', encodeURIComponent(stack)).replace('{range}', range),
),
)
+ await inPool(urls, url => warm(cache, url))
}
return readTileSources(style, cache)
@@ -233,7 +283,7 @@ export async function prefetchVectorForPlaces(
const bbox = computeBbox(places)
if (!bbox) return { tiles: 0, template: null }
- const sources = await prefetchStyle(styleUrl)
+ const sources = await prefetchStyle(styleUrl, bbox)
const template = sources?.[0]?.template ?? null
if (!sources?.length || isCancelled()) return { tiles: 0, template }
@@ -242,13 +292,18 @@ export async function prefetchVectorForPlaces(
let cursor = 0
let fetched = 0
+ let bytes = 0
async function worker(): Promise {
while (cursor < urls.length) {
- if (isCancelled() || !navigator.onLine) return
+ if (isCancelled() || !navigator.onLine || bytes >= MAX_RUN_BYTES) return
const url = urls[cursor++]
if (!url) return
- if (await warm(cache, url)) fetched++
+ const size = await warm(cache, url)
+ if (size > 0) {
+ fetched++
+ bytes += size
+ }
}
}
@@ -256,6 +311,19 @@ export async function prefetchVectorForPlaces(
return { tiles: fetched, template }
}
+/** Runs `task` over `items`, CONCURRENCY at a time. */
+async function inPool(items: T[], task: (item: T) => Promise): Promise {
+ let cursor = 0
+ async function worker(): Promise {
+ while (cursor < items.length) {
+ const item = items[cursor++]
+ if (item === undefined) return
+ await task(item)
+ }
+ }
+ await Promise.all(Array.from({ length: CONCURRENCY }, () => worker()))
+}
+
/** Drop the offline vector basemap, alongside the raster cache. */
export async function clearVectorCache(): Promise {
try {
diff --git a/client/src/sync/tilePrefetcher.ts b/client/src/sync/tilePrefetcher.ts
index 120c054cb..4a1416bd6 100644
--- a/client/src/sync/tilePrefetcher.ts
+++ b/client/src/sync/tilePrefetcher.ts
@@ -28,8 +28,10 @@ import { offlineDb, upsertSyncMeta } from '../db/offlineDb'
import { isAuthed } from './authGate'
import { isStoragePersisted } from './persistentStorage'
import { isVectorStyle, normalizeTileUrl, resolveTileUrl, withTileApiKey } from '../utils/tileUrl'
-import { OFM_POSITRON } from '../constants/mapDefaults'
-import { clearVectorCache, prefetchVectorForPlaces } from './glPrefetcher'
+import { OFM_DARK, OFM_POSITRON } from '../constants/mapDefaults'
+import { clearVectorCache, prefetchStyleAssets, prefetchVectorForPlaces } from './glPrefetcher'
+import { isOfflineForbiddenTemplate } from '../components/Map/offlineBasemap'
+import { isNativeIos } from '../native/platform'
// ── Constants ─────────────────────────────────────────────────────────────────
@@ -385,6 +387,21 @@ function sameBbox(a: [number, number, number, number], b: TileBbox): boolean {
)
}
+/** The OpenFreeMap styles the offline fallback draws; they share one tile set. */
+const OFFLINE_BASEMAPS: readonly string[] = [OFM_POSITRON, OFM_DARK]
+
+/**
+ * The trip's region of the offline basemap: the light style's tiles, style,
+ * sprite and glyphs, and the dark style's own style, sprite and glyphs on top,
+ * whose tiles are the same ones.
+ */
+async function prefetchOfflineBasemap(places: Place[], template: string, cancelled: () => boolean): Promise {
+ const light = template === OFM_DARK ? OFM_DARK : OFM_POSITRON
+ const other = light === OFM_DARK ? OFM_POSITRON : OFM_DARK
+ await prefetchVectorForPlaces(places, light, cancelled).catch(console.error)
+ if (!cancelled()) await prefetchStyleAssets(other, computeBbox(places)).catch(console.error)
+}
+
/**
* Full pipeline: compute bbox → guard → prefetch → update syncMeta.
* Designed to be called fire-and-forget from tripSyncManager.
@@ -415,8 +432,16 @@ export async function prefetchTilesForTrip(
// The default basemap is a vector style, and walking a {z}/{x}/{y} template
// over one would fetch nothing the map ever asks for. A user who configured
// their own raster template keeps the path below unchanged.
+ const cancelled = () => !navigator.onLine || !isAuthed()
+ // Whatever the map is set to, the trip's region of the offline basemap goes
+ // along: offline, a Mapbox map or one the device cannot serve switches to it
+ // (components/Map/offlineBasemap.ts).
+ await prefetchOfflineBasemap(places, template, cancelled)
+
if (isVectorStyle(template)) {
- const { tiles } = await prefetchVectorForPlaces(places, template, () => !navigator.onLine || !isAuthed())
+ const { tiles } = OFFLINE_BASEMAPS.includes(template)
+ ? { tiles: 0 }
+ : await prefetchVectorForPlaces(places, template, cancelled)
const meta = await offlineDb.syncMeta.get(tripId)
if (meta) {
await upsertSyncMeta({
@@ -447,7 +472,12 @@ export async function prefetchTilesForTrip(
// dozen tiles (#2180); the deep ones are the volume, and they are what the
// user loses rather than the ability to start the app at all (#2228).
const maxZoom = isStoragePersisted() ? 16 : UNPERSISTED_MAX_ZOOM
- const fetched = await prefetchTiles(bbox, template, 0, maxZoom, cartoKey)
+ // Not for a host whose tiles may not be stored (OSM's tile usage policy), and
+ // not inside the iOS app, whose WebView runs no service worker to serve them:
+ // the offline basemap above stands in there.
+ const fetched = isOfflineForbiddenTemplate(template) || isNativeIos()
+ ? 0
+ : await prefetchTiles(bbox, template, 0, maxZoom, cartoKey)
// Update syncMeta with bbox and tile count
const meta = await offlineDb.syncMeta.get(tripId)
diff --git a/client/tests/unit/sync/tilePrefetcher.test.ts b/client/tests/unit/sync/tilePrefetcher.test.ts
index f3fb5a059..96b3f3e8b 100644
--- a/client/tests/unit/sync/tilePrefetcher.test.ts
+++ b/client/tests/unit/sync/tilePrefetcher.test.ts
@@ -26,6 +26,21 @@ import { offlineDb, clearAll, upsertSyncMeta } from '../../../src/db/offlineDb';
import { requestPersistentStorage, _resetPersistentStorage } from '../../../src/sync/persistentStorage';
import { setAuthed } from '../../../src/sync/authGate';
import { buildPlace } from '../../helpers/factories';
+import { prefetchStyleAssets, prefetchVectorForPlaces } from '../../../src/sync/glPrefetcher';
+import { isNativeIos } from '../../../src/native/platform';
+import { OFM_DARK, OFM_POSITRON } from '../../../src/constants/mapDefaults';
+
+// The vector basemap has its own tests (glPrefetcher.test.ts). Here it is a seam,
+// so the raster runs below count only their own tile requests.
+vi.mock('../../../src/sync/glPrefetcher', async importOriginal => ({
+ ...(await importOriginal()),
+ prefetchVectorForPlaces: vi.fn(async () => ({ tiles: 0, template: null })),
+ prefetchStyleAssets: vi.fn(async () => null),
+}));
+vi.mock('../../../src/native/platform', async importOriginal => ({
+ ...(await importOriginal()),
+ isNativeIos: vi.fn(() => false),
+}));
beforeEach(async () => {
await clearAll();
@@ -406,6 +421,48 @@ describe('prefetchTilesForTrip', () => {
});
});
+// ── the offline basemap ───────────────────────────────────────────────────────
+
+describe('prefetchTilesForTrip — the offline basemap', () => {
+ const places = [buildPlace({ trip_id: 1, lat: 35.68, lng: 139.76 })];
+
+ beforeEach(async () => {
+ await upsertSyncMeta({ tripId: 1, lastSyncedAt: Date.now(), status: 'idle', tilesBbox: null, filesCachedCount: 0 });
+ vi.mocked(prefetchVectorForPlaces).mockClear();
+ vi.mocked(prefetchStyleAssets).mockClear();
+ vi.mocked(isNativeIos).mockReturnValue(false);
+ });
+
+ it('stores the light and dark OpenFreeMap styles for a trip on any provider', async () => {
+ await prefetchTilesForTrip(1, places, 'https://{s}.example.com/{z}/{x}/{y}.png');
+
+ expect(vi.mocked(prefetchVectorForPlaces).mock.calls.map(c => c[1])).toEqual([OFM_POSITRON]);
+ expect(vi.mocked(prefetchStyleAssets).mock.calls.map(c => c[0])).toEqual([OFM_DARK]);
+ });
+
+ it('does not walk the stored style twice when it is the configured one', async () => {
+ await prefetchTilesForTrip(1, places, OFM_POSITRON);
+
+ expect(vi.mocked(prefetchVectorForPlaces)).toHaveBeenCalledTimes(1);
+ });
+
+ it('never prefetches OpenStreetMap standard tiles, which their policy forbids', async () => {
+ await prefetchTilesForTrip(1, places, 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
+
+ expect(vi.mocked(fetch).mock.calls.some(c => String(c[0]).includes('tile.openstreetmap.org'))).toBe(false);
+ expect(vi.mocked(prefetchVectorForPlaces)).toHaveBeenCalled();
+ });
+
+ it('skips raster tiles inside the iOS app, which has no service worker to serve them', async () => {
+ vi.mocked(isNativeIos).mockReturnValue(true);
+
+ await prefetchTilesForTrip(1, places, 'https://{s}.example.com/{z}/{x}/{y}.png');
+
+ expect(vi.mocked(fetch)).not.toHaveBeenCalled();
+ expect(vi.mocked(prefetchVectorForPlaces)).toHaveBeenCalled();
+ });
+});
+
// ── repeat runs ───────────────────────────────────────────────────────────────
describe('prefetchTilesForTrip — repeat runs', () => {
diff --git a/shared/src/i18n/ar/map.ts b/shared/src/i18n/ar/map.ts
index 4595bf8c2..572c62cf9 100644
--- a/shared/src/i18n/ar/map.ts
+++ b/shared/src/i18n/ar/map.ts
@@ -52,5 +52,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'لا يوفّر هذا المتصفح WebGL2 الذي تحتاجه خرائط GL، لذا تُعرض الخرائط باستخدام Leaflet بدلًا منها.',
'map.webgl2.terrain': 'يحتاج العرض ثلاثي الأبعاد إلى WebGL2، وهذا المتصفح لا يوفّره. تبقى الخريطة ثنائية الأبعاد.',
+ 'map.offlineBasemap': 'خريطة دون اتصال',
};
export default map;
diff --git a/shared/src/i18n/az/map.ts b/shared/src/i18n/az/map.ts
index b8e228698..6f00aa0ca 100644
--- a/shared/src/i18n/az/map.ts
+++ b/shared/src/i18n/az/map.ts
@@ -50,6 +50,7 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Bu brauzer GL xəritələrinin ehtiyac duyduğu WebGL2-ni təqdim etmir, ona görə xəritələr Leaflet ilə göstərilir.',
'map.webgl2.terrain': '3D üçün WebGL2 lazımdır, bu brauzer isə onu təqdim etmir. Xəritə 2D olaraq qalır.',
+ 'map.offlineBasemap': 'Oflayn xəritə',
};
export default map;
diff --git a/shared/src/i18n/br/map.ts b/shared/src/i18n/br/map.ts
index 96b01ba14..bf433284d 100644
--- a/shared/src/i18n/br/map.ts
+++ b/shared/src/i18n/br/map.ts
@@ -47,5 +47,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Este navegador não oferece WebGL2, necessário para os mapas GL, por isso os mapas são exibidos com o Leaflet.',
'map.webgl2.terrain': 'O 3D precisa de WebGL2, que este navegador não oferece. O mapa continua em 2D.',
+ 'map.offlineBasemap': 'Mapa offline',
};
export default map;
diff --git a/shared/src/i18n/ca/map.ts b/shared/src/i18n/ca/map.ts
index 15f66e8a3..502acda19 100644
--- a/shared/src/i18n/ca/map.ts
+++ b/shared/src/i18n/ca/map.ts
@@ -45,5 +45,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Aquest navegador no ofereix WebGL2, que necessiten els mapes GL, així que els mapes es mostren amb Leaflet.',
'map.webgl2.terrain': 'El 3D necessita WebGL2, que aquest navegador no ofereix. El mapa es queda en 2D.',
+ 'map.offlineBasemap': 'Mapa fora de línia',
};
export default map;
diff --git a/shared/src/i18n/cs/map.ts b/shared/src/i18n/cs/map.ts
index 0139c1030..407292af7 100644
--- a/shared/src/i18n/cs/map.ts
+++ b/shared/src/i18n/cs/map.ts
@@ -46,5 +46,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Tento prohlížeč nenabízí WebGL2, které mapy GL potřebují, proto se mapy zobrazují pomocí Leafletu.',
'map.webgl2.terrain': '3D potřebuje WebGL2, které tento prohlížeč nenabízí. Mapa zůstává ve 2D.',
+ 'map.offlineBasemap': 'Offline mapa',
};
export default map;
diff --git a/shared/src/i18n/de/map.ts b/shared/src/i18n/de/map.ts
index c8df7a83b..951536543 100644
--- a/shared/src/i18n/de/map.ts
+++ b/shared/src/i18n/de/map.ts
@@ -47,5 +47,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Dieser Browser bietet kein WebGL2, das GL-Karten brauchen. Karten werden deshalb mit Leaflet angezeigt.',
'map.webgl2.terrain': '3D braucht WebGL2, das dieser Browser nicht bietet. Die Karte bleibt in 2D.',
+ 'map.offlineBasemap': 'Offline-Karte',
};
export default map;
diff --git a/shared/src/i18n/en/map.ts b/shared/src/i18n/en/map.ts
index 03a8767e9..531d0252b 100644
--- a/shared/src/i18n/en/map.ts
+++ b/shared/src/i18n/en/map.ts
@@ -45,5 +45,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'This browser does not offer WebGL2, which GL maps need, so maps are shown with Leaflet instead.',
'map.webgl2.terrain': '3D needs WebGL2, which this browser does not offer. The map stays in 2D.',
+ 'map.offlineBasemap': 'Offline map',
};
export default map;
diff --git a/shared/src/i18n/es/map.ts b/shared/src/i18n/es/map.ts
index 5eca743c0..974495e1c 100644
--- a/shared/src/i18n/es/map.ts
+++ b/shared/src/i18n/es/map.ts
@@ -44,5 +44,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Este navegador no ofrece WebGL2, que necesitan los mapas GL, así que los mapas se muestran con Leaflet.',
'map.webgl2.terrain': 'El 3D necesita WebGL2, que este navegador no ofrece. El mapa se queda en 2D.',
+ 'map.offlineBasemap': 'Mapa sin conexión',
};
export default map;
diff --git a/shared/src/i18n/et/map.ts b/shared/src/i18n/et/map.ts
index 552dc0cec..8871e8086 100644
--- a/shared/src/i18n/et/map.ts
+++ b/shared/src/i18n/et/map.ts
@@ -43,5 +43,6 @@ const map: TranslationStrings = {
'map.baseLayer.topo': 'Topograafiline',
'map.webgl2.fallback': 'See brauser ei paku WebGL2-te, mida GL-kaardid vajavad, seega kuvatakse kaardid Leafletiga.',
'map.webgl2.terrain': '3D vajab WebGL2-te, mida see brauser ei paku. Kaart jääb 2D-vaatesse.',
+ 'map.offlineBasemap': 'Võrguühenduseta kaart',
};
export default map;
diff --git a/shared/src/i18n/fr/map.ts b/shared/src/i18n/fr/map.ts
index af8170e26..316f4adbf 100644
--- a/shared/src/i18n/fr/map.ts
+++ b/shared/src/i18n/fr/map.ts
@@ -46,5 +46,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Ce navigateur ne propose pas WebGL2, nécessaire aux cartes GL : les cartes s’affichent donc avec Leaflet.',
'map.webgl2.terrain': 'La 3D nécessite WebGL2, que ce navigateur ne propose pas. La carte reste en 2D.',
+ 'map.offlineBasemap': 'Carte hors ligne',
};
export default map;
diff --git a/shared/src/i18n/gr/map.ts b/shared/src/i18n/gr/map.ts
index 4bc53c6e6..22b24e22b 100644
--- a/shared/src/i18n/gr/map.ts
+++ b/shared/src/i18n/gr/map.ts
@@ -46,5 +46,6 @@ const map: TranslationStrings = {
'Αυτό το πρόγραμμα περιήγησης δεν προσφέρει WebGL2, που χρειάζονται οι χάρτες GL, οπότε οι χάρτες εμφανίζονται με το Leaflet.',
'map.webgl2.terrain':
'Το 3D χρειάζεται WebGL2, που αυτό το πρόγραμμα περιήγησης δεν προσφέρει. Ο χάρτης μένει σε 2D.',
+ 'map.offlineBasemap': 'Χάρτης εκτός σύνδεσης',
};
export default map;
diff --git a/shared/src/i18n/he/map.ts b/shared/src/i18n/he/map.ts
index 94f674e24..ec7c202a4 100644
--- a/shared/src/i18n/he/map.ts
+++ b/shared/src/i18n/he/map.ts
@@ -45,6 +45,7 @@ const map: TranslationStrings = {
'map.baseLayer.topo': 'טופוגרפית',
'map.webgl2.fallback': 'הדפדפן הזה לא תומך ב-WebGL2, שמפות GL צריכות, ולכן המפות מוצגות עם Leaflet.',
'map.webgl2.terrain': 'תלת-ממד דורש WebGL2, והדפדפן הזה לא תומך בו. המפה נשארת בדו-ממד.',
+ 'map.offlineBasemap': 'מפה לא מקוונת',
};
export default map;
diff --git a/shared/src/i18n/hu/map.ts b/shared/src/i18n/hu/map.ts
index f526a44fa..bfd29efff 100644
--- a/shared/src/i18n/hu/map.ts
+++ b/shared/src/i18n/hu/map.ts
@@ -44,5 +44,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Ez a böngésző nem kínál WebGL2-t, amelyre a GL-térképeknek szükségük van, ezért a térképek Leaflettel jelennek meg.',
'map.webgl2.terrain': 'A 3D-hez WebGL2 kell, amelyet ez a böngésző nem kínál. A térkép 2D-ben marad.',
+ 'map.offlineBasemap': 'Offline térkép',
};
export default map;
diff --git a/shared/src/i18n/id/map.ts b/shared/src/i18n/id/map.ts
index 3feb67b3b..46a4dd820 100644
--- a/shared/src/i18n/id/map.ts
+++ b/shared/src/i18n/id/map.ts
@@ -43,5 +43,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Browser ini tidak menyediakan WebGL2 yang dibutuhkan peta GL, jadi peta ditampilkan dengan Leaflet.',
'map.webgl2.terrain': '3D membutuhkan WebGL2, yang tidak disediakan browser ini. Peta tetap dalam 2D.',
+ 'map.offlineBasemap': 'Peta offline',
};
export default map;
diff --git a/shared/src/i18n/it/map.ts b/shared/src/i18n/it/map.ts
index 89687a927..91a345d17 100644
--- a/shared/src/i18n/it/map.ts
+++ b/shared/src/i18n/it/map.ts
@@ -47,5 +47,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Questo browser non offre WebGL2, necessario alle mappe GL, quindi le mappe vengono mostrate con Leaflet.',
'map.webgl2.terrain': 'Il 3D richiede WebGL2, che questo browser non offre. La mappa resta in 2D.',
+ 'map.offlineBasemap': 'Mappa offline',
};
export default map;
diff --git a/shared/src/i18n/ja/map.ts b/shared/src/i18n/ja/map.ts
index 6c778b8bc..af4a2b1cb 100644
--- a/shared/src/i18n/ja/map.ts
+++ b/shared/src/i18n/ja/map.ts
@@ -43,5 +43,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'このブラウザーは GL マップに必要な WebGL2 に対応していないため、地図は Leaflet で表示されます。',
'map.webgl2.terrain': '3D には WebGL2 が必要ですが、このブラウザーは対応していません。地図は 2D のままです。',
+ 'map.offlineBasemap': 'オフライン地図',
};
export default map;
diff --git a/shared/src/i18n/ko/map.ts b/shared/src/i18n/ko/map.ts
index b4a5c2f26..544b39650 100644
--- a/shared/src/i18n/ko/map.ts
+++ b/shared/src/i18n/ko/map.ts
@@ -42,5 +42,6 @@ const map: TranslationStrings = {
'map.baseLayer.topo': '지형도',
'map.webgl2.fallback': '이 브라우저는 GL 지도에 필요한 WebGL2를 지원하지 않아 지도를 Leaflet으로 표시합니다.',
'map.webgl2.terrain': '3D에는 WebGL2가 필요하지만 이 브라우저는 지원하지 않습니다. 지도는 2D로 유지됩니다.',
+ 'map.offlineBasemap': '오프라인 지도',
};
export default map;
diff --git a/shared/src/i18n/nl/map.ts b/shared/src/i18n/nl/map.ts
index 486bbdd2e..bca23f52b 100644
--- a/shared/src/i18n/nl/map.ts
+++ b/shared/src/i18n/nl/map.ts
@@ -46,5 +46,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Deze browser biedt geen WebGL2, dat GL-kaarten nodig hebben, dus kaarten worden met Leaflet getoond.',
'map.webgl2.terrain': '3D heeft WebGL2 nodig, dat deze browser niet biedt. De kaart blijft in 2D.',
+ 'map.offlineBasemap': 'Offline kaart',
};
export default map;
diff --git a/shared/src/i18n/pl/map.ts b/shared/src/i18n/pl/map.ts
index 74c943dde..126d4d7c8 100644
--- a/shared/src/i18n/pl/map.ts
+++ b/shared/src/i18n/pl/map.ts
@@ -49,5 +49,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Ta przeglądarka nie obsługuje WebGL2, którego potrzebują mapy GL, więc mapy są wyświetlane za pomocą Leaflet.',
'map.webgl2.terrain': 'Tryb 3D wymaga WebGL2, którego ta przeglądarka nie obsługuje. Mapa pozostaje w 2D.',
+ 'map.offlineBasemap': 'Mapa offline',
};
export default map;
diff --git a/shared/src/i18n/ru/map.ts b/shared/src/i18n/ru/map.ts
index e054bb65a..6114a6b49 100644
--- a/shared/src/i18n/ru/map.ts
+++ b/shared/src/i18n/ru/map.ts
@@ -50,5 +50,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Этот браузер не поддерживает WebGL2, нужный картам GL, поэтому карты показываются через Leaflet.',
'map.webgl2.terrain': 'Для 3D нужен WebGL2, а этот браузер его не поддерживает. Карта остаётся в 2D.',
+ 'map.offlineBasemap': 'Офлайн-карта',
};
export default map;
diff --git a/shared/src/i18n/sk/map.ts b/shared/src/i18n/sk/map.ts
index 565b82971..231d5d0dc 100644
--- a/shared/src/i18n/sk/map.ts
+++ b/shared/src/i18n/sk/map.ts
@@ -46,5 +46,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Tento prehliadač neponúka WebGL2, ktoré mapy GL potrebujú, preto sa mapy zobrazujú pomocou Leafletu.',
'map.webgl2.terrain': '3D potrebuje WebGL2, ktoré tento prehliadač neponúka. Mapa zostáva v 2D.',
+ 'map.offlineBasemap': 'Offline mapa',
};
export default map;
diff --git a/shared/src/i18n/sv/map.ts b/shared/src/i18n/sv/map.ts
index 9386ee555..7cde3cfb1 100644
--- a/shared/src/i18n/sv/map.ts
+++ b/shared/src/i18n/sv/map.ts
@@ -44,5 +44,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
'Den här webbläsaren erbjuder inte WebGL2, som GL-kartor behöver, så kartorna visas med Leaflet i stället.',
'map.webgl2.terrain': '3D kräver WebGL2, som den här webbläsaren inte erbjuder. Kartan stannar i 2D.',
+ 'map.offlineBasemap': 'Offlinekarta',
};
export default map;
diff --git a/shared/src/i18n/th/map.ts b/shared/src/i18n/th/map.ts
index c4e3f027f..288de9af7 100644
--- a/shared/src/i18n/th/map.ts
+++ b/shared/src/i18n/th/map.ts
@@ -41,5 +41,6 @@ const map: TranslationStrings = {
'map.baseLayer.topo': 'ภูมิประเทศ',
'map.webgl2.fallback': 'เบราว์เซอร์นี้ไม่รองรับ WebGL2 ที่แผนที่ GL ต้องใช้ จึงแสดงแผนที่ด้วย Leaflet แทน',
'map.webgl2.terrain': 'โหมด 3D ต้องใช้ WebGL2 ซึ่งเบราว์เซอร์นี้ไม่รองรับ แผนที่จึงยังคงเป็น 2D',
+ 'map.offlineBasemap': 'แผนที่ออฟไลน์',
};
export default map;
diff --git a/shared/src/i18n/tr/map.ts b/shared/src/i18n/tr/map.ts
index 62374c2c8..70b1df378 100644
--- a/shared/src/i18n/tr/map.ts
+++ b/shared/src/i18n/tr/map.ts
@@ -44,5 +44,6 @@ const map: TranslationStrings = {
'map.webgl2.fallback':
"Bu tarayıcı GL haritalarının ihtiyaç duyduğu WebGL2'yi sunmuyor, bu yüzden haritalar Leaflet ile gösteriliyor.",
'map.webgl2.terrain': '3D için WebGL2 gerekir, bu tarayıcı ise onu sunmuyor. Harita 2D olarak kalır.',
+ 'map.offlineBasemap': 'Çevrimdışı harita',
};
export default map;
diff --git a/shared/src/i18n/uk/map.ts b/shared/src/i18n/uk/map.ts
index c6566c57d..4db23d21f 100644
--- a/shared/src/i18n/uk/map.ts
+++ b/shared/src/i18n/uk/map.ts
@@ -48,5 +48,6 @@ const map: TranslationStrings = {
'map.baseLayer.topo': 'Топо',
'map.webgl2.fallback': 'Цей браузер не підтримує WebGL2, потрібний картам GL, тому карти показуються через Leaflet.',
'map.webgl2.terrain': 'Для 3D потрібен WebGL2, а цей браузер його не підтримує. Карта залишається у 2D.',
+ 'map.offlineBasemap': 'Офлайн-карта',
};
export default map;
diff --git a/shared/src/i18n/vi/map.ts b/shared/src/i18n/vi/map.ts
index 7124d6d27..34ce24447 100644
--- a/shared/src/i18n/vi/map.ts
+++ b/shared/src/i18n/vi/map.ts
@@ -44,5 +44,6 @@ const map: TranslationStrings = {
'map.baseLayer.topo': 'Địa hình',
'map.webgl2.fallback': 'Trình duyệt này không hỗ trợ WebGL2 mà bản đồ GL cần, nên bản đồ được hiển thị bằng Leaflet.',
'map.webgl2.terrain': 'Chế độ 3D cần WebGL2, nhưng trình duyệt này không hỗ trợ. Bản đồ vẫn ở dạng 2D.',
+ 'map.offlineBasemap': 'Bản đồ ngoại tuyến',
};
export default map;
diff --git a/shared/src/i18n/zh-TW/map.ts b/shared/src/i18n/zh-TW/map.ts
index 9868dce15..9c00df569 100644
--- a/shared/src/i18n/zh-TW/map.ts
+++ b/shared/src/i18n/zh-TW/map.ts
@@ -40,5 +40,6 @@ const map: TranslationStrings = {
'map.baseLayer.topo': '地形圖',
'map.webgl2.fallback': '此瀏覽器不支援 GL 地圖所需的 WebGL2,因此地圖改用 Leaflet 顯示。',
'map.webgl2.terrain': '3D 需要 WebGL2,而此瀏覽器不支援。地圖維持 2D。',
+ 'map.offlineBasemap': '離線地圖',
};
export default map;
diff --git a/shared/src/i18n/zh/map.ts b/shared/src/i18n/zh/map.ts
index 5605cb727..bef81a9de 100644
--- a/shared/src/i18n/zh/map.ts
+++ b/shared/src/i18n/zh/map.ts
@@ -40,5 +40,6 @@ const map: TranslationStrings = {
'map.baseLayer.topo': '地形图',
'map.webgl2.fallback': '此浏览器不支持 GL 地图所需的 WebGL2,因此地图改用 Leaflet 显示。',
'map.webgl2.terrain': '3D 需要 WebGL2,而此浏览器不支持。地图保持 2D。',
+ 'map.offlineBasemap': '离线地图',
};
export default map;