#3394·kepler.gl

[错误] 移动时 3D 地图中的地形会出现抖动

作者: leverglowh创建于 2026年4月29日更新于 2026年6月8日
标签bug

Describe the bug After adding terrain to a maplibre map in 3d mode, the map camera elevation changes during movement, seemingly following terrain elevation. This bug was observed and resolved over at react-map-gl at v8 (see https://GitHub.com/visgl/react-map-gl/issues/2211) while Kepler is currently using v7. The weird thing is when I tested the bug with react-map-gl directly, I was only able to reproduce it with react-map-gl v7 + maplibre-gl-js v2. Kepler is currently dependent on MaplibreGL 3.6.2, which according to my tests should only jitter on "moveend". I'll summarize the versions and bug behavior: | react-map-gl | maplibre-gl-js | Bug behavior | --- | --- | --- | 8.1.1 | 4.7.1 | no issue | 8.1.1 | 2.4.0 / 3.6.2 | no issue | 7.1.6 | 3.6.2 | jitter on moveend | 7.1.6 | 2.4.0 | jitter during move | To Reproduce Move the map to somewhere with a lot of mountains then move around. I've created a minimal repo to reproduce this issue with Kepler: https://GitHub.com/leverglowh/keplergl-terrain-jitter Steps are the usual: git clone, npm install, add .env file, npm run dev (starts at port 5668) Only relevant code is in /src/App.tsx. --- To test react-map-gl with maplibre-gl-js all I did was: 1. clone https://GitHub.com/visgl/react-map-gl/tree/master/examples/get-started/maplibre 2. pin versions in package.json. Note: import path changes between v8 and v7, see import changes 3. update app.jsx to include terrain: update line 17 to be: ```jsx mapStyle = { version: 8, sources: { osm: { type: "raster", tiles: ["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"], tileSize: 256, attribution: "© OpenStreetMap Contributors", maxzoom: 19, }, terrain: { type: "raster-dem", url: "https://tiles.mapterhorn.com/tilejson.json", }, hillshadeSource: { type: "raster-dem", url: "https://tiles.mapterhorn.com/tilejson.json", }, }, layers: [ { id: "osm", type: "raster", source: "osm", }, { id: "hillshade", type: "hillshade", source: "hillshadeSource", layout: { visibility: "visible" }, paint: { "hillshade-shadow-color": "#473B24", }, }, ], terrain: { source: "terrain", exaggeration: 1.5, }, sky: {}, }, 4. npm install 5. npm run start Expected behavior Given the current dependencies, I would expect Kepler's map to jitter on moveend, and not during move. Would be nice if it didn't jitter at all. Would also be nice if we could upgrade to react-map-gl v8, but that requires some work since export paths and types changed. Screenshots https://GitHub.com/user-attachments/assets/9737eb0c-8289-4c9e-aa64-8f116a1abd78 Desktop (please complete the following information): OS: …

内容来源: keplergl/kepler.gl