Open YBFACC opened 4 months ago
// 添加天地图底图
function addTile(viewer: Viewer, layer: TileType) {
const tMapImagery = new WebMapTileServiceImageryProvider({
url: https://t{s}.tianditu.gov.cn/${layer}_w/wmts?tk=${tiandiKey}
,
layer,
style: "default",
tileMatrixSetID: "w",
format: "tiles",
subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
maximumLevel: 18
})
viewer.imageryLayers.addImageryProvider(tMapImagery)
}
addTile(viewer, 'img')
addTile(viewer, 'cia')
直接使用官方的例子无法搭建 因为 CESIUM_BASE_URL 需要指定一个服务器上固定能访问的路径 使用插件解决 vite-plugin-cesium