From 5c5fa7c36bf8612a292da058f1bce70e23168901 Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Wed, 4 Nov 2026 23:33:29 -0800 Subject: [PATCH] Put the version into the marker tile URL urlTemplate(routeId:version:) dropped the version, so the URL never changed. Tiles are served with a long Cache-Control, and the map kept the tiles it had already drawn: a marker change reached only tiles that came into view later, and a label crossing a seam was cut where the neighbour was still the old picture. MapLibre, Mapbox, MapTiler and Mappls build their URL this way. --- Sources/MapConductorCore/LocalTileServer.swift | 10 ++++++++-- api/MapConductorCore.api.swift | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Sources/MapConductorCore/LocalTileServer.swift b/Sources/MapConductorCore/LocalTileServer.swift index e553174..61e3ae3 100644 --- a/Sources/MapConductorCore/LocalTileServer.swift +++ b/Sources/MapConductorCore/LocalTileServer.swift @@ -214,9 +214,15 @@ public final class LocalTileServer: @unchecked Sendable { } } - @available(*, deprecated, message: "`version` is ignored. Use `urlTemplate(routeId:tileSize:)` instead.") + /// `version` は URL のパスに入れる。 + /// + /// タイルは長期キャッシュで返すので、URL が変わらないと地図 SDK は描画済みの + /// タイルを取り直さない。以前はここで `version` を捨てていたため、MapLibre / + /// Mapbox / MapTiler / Mappls ではマーカーを変えても新しく見えたタイルにしか + /// 反映されず、境界をまたぐラベルは片側だけ古い絵のまま切れて見えた。 + @available(*, deprecated, message: "Use `urlTemplate(routeId:tileSize:cacheKey:)` instead.") public func urlTemplate(routeId: String, version: Int64) -> String { - urlTemplate(routeId: routeId, tileSize: RasterLayerSource.defaultTileSize) + urlTemplate(routeId: routeId, tileSize: RasterLayerSource.defaultTileSize, cacheKey: "v\(version)") } public func stop() { diff --git a/api/MapConductorCore.api.swift b/api/MapConductorCore.api.swift index 7c9895f..3318217 100644 --- a/api/MapConductorCore.api.swift +++ b/api/MapConductorCore.api.swift @@ -36,7 +36,7 @@ public enum InternalMapConductorApi { final public func urlTemplate(routeId: Swift::String, tileSize: Swift::Int) -> Swift::String final public func urlTemplate(routeId: Swift::String, tileSize: Swift::Int, cacheKey: Swift::String) -> Swift::String final public func renderLocalTile(url: Foundation::URL, isCancelled: @escaping @Sendable () -> Swift::Bool = { false }) -> Foundation::Data? - @available(*, deprecated, message: "`version` is ignored. Use `urlTemplate(routeId:tileSize:)` instead.") + @available(*, deprecated, message: "Use `urlTemplate(routeId:tileSize:cacheKey:)` instead.") final public func urlTemplate(routeId: Swift::String, version: Swift::Int64) -> Swift::String final public func stop() public static func startServer(forceNoStoreCache: Swift::Bool = false) -> MapConductorCore::LocalTileServer