cesium切换图层及初始时定位至中国
/** 中国坐标 */
getChinaPostion() {
return Cartesian3.fromDegrees(116.435314, 40.960521, 10000000.0);
},
/**
*初始定位中国
* */
flytochina() {
viewer.camera.flyTo({
destination: this.getChinaPostion(),
duration: 8
});
},
/**
* 切换地图
*/
changeBaseMap(type) {
viewer.imageryLayers.removeAll();
switch (type) {
//天地图
case "tdt":
viewer.imageryLayers.addImageryProvider(
new WebMapTileServiceImageryProvider({
url:
"https://t0.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=93d1fdef41f93d2211deed6d22780c48",
layer: "tdtBasicLayer",
style: "default",
format: "image/jpeg",
tileMatrixSetID: "GoogleMapsCompatible",
show: false,
maximumLevel: 16
})
);
break;
//天地图矢量
case "tdtsl":
viewer.imageryLayers.addImageryProvider(
new WebMapTileServiceImageryProvider({
url:
"https://t0.tianditu.com/vec_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=vec&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=93d1fdef41f93d2211deed6d22780c48",
layer: "tdtVecBasicLayer",
style: "default",
format: "image/jpeg",
tileMatrixSetID: "GoogleMapsCompatible",
show: false
})
);
break;
//谷歌影像
case "gg":
var url =
"https://mt1.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali";
viewer.imageryLayers.addImageryProvider(
new UrlTemplateImageryProvider({ url: url })
);
break;
case "arcgis":
viewer.imageryLayers.addImageryProvider(
new ArcGisMapServerImageryProvider({
url:
"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
enablePickFeatures: false
})
);
break;
//必应
case "bing":
viewer.imageryLayers.addImageryProvider(
new BingMapsImageryProvider({
url: "https://dev.virtualearth.net",
key: "get-yours-at-https://www.bingmapsportal.com/",
mapStyle: BingMapsStyle.AERIAL
})
);
break;
case "dark":
viewer.imageryLayers.addImageryProvider(
new createTileMapServiceImageryProvider({
url: "https://cesiumjs.org/blackmarble",
credit: "Black Marble imagery courtesy NASA Earth Observatory",
flipXY: true // Only old gdal2tile.py generated tilesets need this flag.
})
);
break;
}//全球影像中文注记服务
viewer.imageryLayers.addImageryProvider(
new WebMapTileServiceImageryProvider({
url:
"https://t0.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=93d1fdef41f93d2211deed6d22780c48",
layer: "tdtAnnoLayer",
style: "default",
format: "image/jpeg",
tileMatrixSetID: "GoogleMapsCompatible",
show: false
})
);
//全球矢量中文标注服务
viewer.imageryLayers.addImageryProvider(
new WebMapTileServiceImageryProvider({
url:
"https://t0.tianditu.com/cva_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cva&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=93d1fdef41f93d2211deed6d22780c48",
layer: "tdtAnnoLayer",
style: "default",
format: "image/jpeg",
tileMatrixSetID: "GoogleMapsCompatible"
})
);
}
【cesium切换图层及初始时定位至中国】
推荐阅读
- Cesium|Cesium 粒子系统学习
- 242为什么不断切换任务会更容易累()
- 洗洗睡了|洗洗睡了 | 休息的时候,千万注意切换你的行为模式
- 有生之年
- Cesium入门8|Cesium入门8 - Configuring the Scene - 配置视窗
- CPU|CPU 上下文切换
- 50.图层基础一
- 2018.12.14《只管去做》切换工作状态
- SwiftUI|SwiftUI Button监听点击和释放消息 实现照片切换 (教程含源码 技术大全)
- android仿抖音上下切换视频|android仿抖音上下切换视频,仿抖音上下滑动切换视频