YBFACC / blog

仅记录个人学习使用
3 stars 0 forks source link

vite 中使用 cesium #56

Open YBFACC opened 4 months ago

YBFACC commented 4 months ago

直接使用官方的例子无法搭建 因为 CESIUM_BASE_URL 需要指定一个服务器上固定能访问的路径 使用插件解决 vite-plugin-cesium

YBFACC commented 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')