Repository navigation
Conversation
MVTLayer#getTileData parses tiles in WGS84 when the viewport has a resolution (GlobeViewport) and in tile coordinates otherwise, but cached tiles were never reloaded when that changed. GlobeView switches to a WebMercatorViewport above zoom 12, so crossing it kept tiles in the old frame: features were misplaced zooming out, and lost on the next sub layer rebuild zooming in. Reload the tileset when the frame changes.
[Medium impact] Fixes tile reloading when viewport coordinate frame changes. The PR appears safe to merge, with a non-blocking display issue while replacement tiles load. Findings
Summary
Reviews (1) · Last reviewed commit: "fix(geo-layers): MVTLayer reloads tiles ..." · Reviewed by Greptile |
| // above zoom 12): tiles loaded in the other frame must be loaded again | ||
| const wgs84 = Boolean(context.viewport.resolution); | ||
| if (wgs84 !== this.state.wgs84) { | ||
| this.state.tileset?.reloadAll(); |
There was a problem hiding this comment.
reloadAll() keeps selected tiles' old content and sublayers. When the user crosses the globe/flat-map boundary, those sublayers keep drawing data from the previous coordinate frame until the new requests finish. Users can still see misplaced features during loading, especially on slow connections. Hide or discard the old-frame content instead of keeping it visible while replacements load.
Knowledge Base Used: Geospatial layer types
There was a problem hiding this comment.
Checked with tile requests delayed by 3 s on a MapLibre globe, right after crossing zoom 12:
- 11.6 → 12.4: the kept sub layers were built for
[lng, lat]data inLNGLAT, which stays valid on theWebMercatorViewport, so they stay in place until the reload finishes. Discarding them instead (finalize()and a new tileset) blanks the view until then. - 12.4 → 11.6: the kept
CARTESIANsub layers draw nothing on theGlobeViewport, so no misplaced features show while loading.
Keeping reloadAll().
There was a problem hiding this comment.
That makes sense. With the delayed-request repro, reloadAll() is the better transition behavior: on Web Mercator → Globe, the retained CARTESIAN sublayers render nothing, while on Globe → Web Mercator, the retained [lng, lat] LNGLAT data remains valid in the new viewport. Replacing the tileset would unnecessarily blank the view, so I withdraw the concern about keeping the old content visible and have no objection to retaining reloadAll().
Closes #10870
Change List
MVTLayer: reload the tileset when the viewport changes coordinate frameThe repro from the issue after zooming from 12.4 to 11.6. Left 9.4.0, right with this change applied.
Follow up of the review on #10869.