maptalks / maptalks/maptalks.js

terrain与mvt同时加载异常的问题

Open
#2,494 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
4.5k
Forks
511
Avg merge
3d 58m
Merged PRs (30d)
1

Description

- mvt是用`GeoJSONVectorTileLayer`加载的
- terrain有两种:用天地图的和cesiumlab切的

- 单独mvt:![Image](https://github.com/user-attachments/assets/829c1c33-354f-40bf-bd20-1ab9a5ac3c2f)
- 叠加天地图地形:![Image](https://github.com/user-attachments/assets/39b82ca3-fc14-4d6d-89cd-9357d58ce472)
- 叠加cesium地形:![Image](https://github.com/user-attachments/assets/35457a3f-e52e-4a71-8355-070f785ef4eb)

代码:
```html

加载地形和矢量瓦片

html,
body {
margin: 0px;
height: 100%;
width: 100%;
}

.container {
width: 100%;
height: 100%;
}


const map = new maptalks.Map("map", {
spatialReference: {
projection: "EPSG:4326",
},
center: [113.53077552, 22.27814626],
minZoom: 11,
zoom: 16.2,
pitch: 46.8,
bearing: -9.15,
});
const terrain = {
minAvailableZoom: 13,
type: "cesium", //or cisium 本地部署的服务就cesium
urlTemplate: "./terrain/{z}/{x}/{y}.terrain",
}
const terrain_tianditu = {
type: "tianditu", //or cisium 本地部署的服务就cesium
urlTemplate:
"https://t{s}.tianditu.gov.cn/mapservice/swdx?T=elv_c&tk=97d2d09de3e54939dd20123859260bf9&x={x}&y={y}&l={z}",
subdomains: ["1", "2", "3", "4", "5"],
exaggeration: 1,
maxAvailableZoom: 14,
};
const tianditu_img = new maptalks.TileLayer("base_img", {
tileSystem: [1, -1, -180, 90],
urlTemplate:
"https://t{s}.tianditu.gov.cn/img_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=a6be5b6191117fed3e04515344d74de9",
subdomains: ["1", "2", "3", "4", "5"],
});
const groupLayer = new maptalks.GroupGLLayer("group", [], {
// terrain: terrain_tianditu,
});
groupLayer.addTo(map);
const net = new maptalks.GeoJSONVectorTileLayer("net", {
data: "/geojson/格网.json",
});
net.setStyle([
{
filter: [
"all",
// ["in", "$layer", "buildings@MyProject2", "heigher_buildings@MyProject2"],
["==", "$type", "Polygon"],
],
renderPlugin: {
type: "lit",
dataConfig: {
type: "3d-extrusion",
minHeightProperty: "bottom",
altitudeProperty: "top",
altitudeScale: 1,
topThickness: 0,
top: true,
side: true,
// awareOfTerrain: true,
},
},
symbol: {
visible: true,
bloom: false,
ssr: false,
polygonOpacity: 0.5,
polygonFill: "#7FDD70",
polygonStroke: "#7FDD70",
polygonStrokeWidth: 1,
},
},
]);
groupLayer.addLayer(net);

```

[加载地形和矢量瓦片.zip](https://github.com/user-attachments/files/18487121/default.zip)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the inline HTML reproduction with the GeoJSONVectorTileLayer inside the GroupGLLayer, then compare the no-terrain case with the Tianditu and Cesium terrain configurations. Inspect the terrain and vector-tile rendering entry points used by maptalks-gl. Done means the vector tiles render correctly together with both terrain sources, without the reported abnormal result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.