var viewer = new Cesium.Viewer("cesiumContainer", {
crossorigin: "anonymous",
animation: false, //是否显示动画控件
baseLayerPicker: false, //是否显示图层选择控件
geocoder: false,
timeline: false, //是否显示时间线控件
sceneModePicker: true, //是否显示投影方式控件2,3D切换控件
navigationHelpButton: false, //是否显示帮助信息控件
infoBox: false, //是否显示点击要素之后显示的信息
fullscreenButton: false,
sceneMode: Cesium.SceneMode.SCENE2D, //默认的显示3D,还是3D
imageryProvider: new Cesium.WebMapTileServiceImageryProvider({
url: "http://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",
layer: "tdtAnnoLayer",
style: "default",
format: "image/jpeg",
tileMatrixSetID: "GoogleMapsCompatible",
show: false,
maximumLevel: 16
})
});
viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({
url: "http://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",
layer: "tdtAnnoLayer", //全球影像中文注记服务
style: "default",
format: "image/jpeg",
tileMatrixSetID: "GoogleMapsCompatible",
show: false
}));
viewer._cesiumWidget._creditContainer.style.display = "none";
var wyoming = viewer.entities.add({ //添加一个实体,仅需要传递一个简单JSON对象,返回值是一个Entity对象
name: 'Wyoming',
polygon: {
hierarchy: Cesium.Cartesian3.fromDegreesArray([ //一组地理坐标
-109.080842, 45.002073, -105.91517, 45.002073, -104.058488, 44.996596, -104.053011, 43.002989, -104.053011, 41.003906, -105.728954, 40.998429, -107.919731, 41.003906, -109.04798, 40.998429, -111.047063, 40.998429, -111.047063, 42.000709, -111.047063, 44.476286, -111.05254, 45.002073
]),
material: Cesium.Color.RED.withAlpha(0.5), //材质
outline: true, //是否显示轮廓
outlineColor: Cesium.Color.BLACK //轮廓的颜色
}
});
viewer.zoomTo(wyoming); //缩放、平移视图使实体可见
var redPolygon = viewer.entities.add({
name: '贴着地表的多边形',
polygon: {
hierarchy: Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -115.0, 32.0, -107.0, 33.0, -102.0, 31.0, -102.0, 35.0]),
material: Cesium.Color.RED
}
});
Viccy
- 发布:2018-07-16 16:08
- 更新:2022-05-30 19:16
- 阅读:2134
1***@163.com
请问你实现了?
2022-11-21 13:51