cesium(笔记-3)

运行环境 | cesium 1.58 | webstorm 2018.2.2 | windows 10 pro

Cesium支持流式的、可视化的全球高程投影地形地势、水形数据,包括海洋、湖泊、河流、山峰、峡谷和其他能够被三维展示出来的且效果比二维好的地形数据。像图层数据一样,Cesium引擎会从一个服务器上请求流式地形数据,仅请求那些基于当前相机能看到的需要绘制的图层上的数据。

1
2
3
4
5
6
7
8
// Load Cesium World Terrain
viewer.terrainProvider = Cesium.createWorldTerrain({
requestWaterMask : true, // required for water effects
requestVertexNormals : true // required for terrain lighting
});

// Enable depth testing so things behind the terrain disappear.
viewer.scene.globe.depthTestAgainstTerrain = true;

高投影的arctic terrain

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// High-resolution arctic terrain from the Arctic DEM project (Release 4), tiled and hosted by Cesium ion.
// https://www.pgc.umn.edu/data/arcticdem/
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: new Cesium.CesiumTerrainProvider({
url: Cesium.IonResource.fromAssetId(3956)
})
});

// Add Alaskan locations
Sandcastle.addDefaultToolbarMenu([{
text: 'Denali',
onselect: function() {
viewer.scene.camera.flyTo({
destination: Cesium.Cartesian3.fromRadians(-2.6399828792482234, 1.0993550795541742, 5795),
orientation: {
heading: 3.8455,
pitch: -0.4535,
roll: 0.0
}
});
}
}, {
text: 'Anchorage Area',
onselect: function() {
viewer.scene.camera.flyTo({
destination: Cesium.Cartesian3.fromRadians(-2.610708034601548, 1.0671172431736584, 1900),
orientation: {
heading: 4.6,
pitch: -0.341,
roll: 0.0
}
});
}
}, {
text: 'Peaks',
onselect: function() {
viewer.scene.camera.flyTo({
destination: Cesium.Cartesian3.fromRadians(-2.6928866820212813, 1.072394255273859, 3700),
orientation: {
heading: 1.6308222948889464,
pitch: -0.6473480165020193,
roll: 0.0
}
});
}
}, {
text: 'Riverbed',
onselect: function() {
viewer.scene.camera.flyTo({
destination: Cesium.Cartesian3.fromRadians(-2.6395623497608596, 1.0976443174490356, 2070),
orientation: {
heading: 6.068794108659519,
pitch: -0.08514161789475816,
roll: 0.0
}
});
}
}], 'toolbar');

高投影的Pennsylvania terrain

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// High resolution terrain of Pennsylvania curated by Pennsylvania Spatial Data Access (PASDA)
// http://www.pasda.psu.edu/
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: new Cesium.CesiumTerrainProvider({
url: Cesium.IonResource.fromAssetId(3957)
})
});

// Add PA locations
Sandcastle.addDefaultToolbarMenu([{
text : 'Pinnacle',
onselect : function() {
viewer.scene.camera.flyTo({
destination : Cesium.Cartesian3.fromRadians(-1.3324415110874286, 0.6954224325279967, 236.6770689945084),
orientation : {
heading : Cesium.Math.toRadians(310),
pitch : Cesium.Math.toRadians(-15),
roll : 0.0
}
});
}
}, {
text : 'Mount Nittany',
onselect : function() {
viewer.scene.camera.flyTo({
destination : Cesium.Cartesian3.fromRadians(-1.358985133937573, 0.7123252393978314, 451.05748252867375),
orientation : {
heading : Cesium.Math.toRadians(85),
pitch : Cesium.Math.toRadians(0),
roll : 0.0
}
});
}
}, {
text : 'Horseshoe Curve',
onselect : function() {
viewer.scene.camera.flyTo({
destination : Cesium.Cartesian3.fromRadians(-1.3700147546199826, 0.706808606166025, 993.7916313325215),
orientation : {
heading : Cesium.Math.toRadians(90),
pitch : Cesium.Math.toRadians(-15),
roll : 0.0
}
});
}
}, {
text : 'Jim Thorpe',
onselect : function() {
viewer.scene.camera.flyTo({
destination : Cesium.Cartesian3.fromRadians(-1.3218297501066052, 0.713358272291525, 240.87968743408845),
orientation : {
heading : Cesium.Math.toRadians(200),
pitch : Cesium.Math.toRadians(-5),
roll : 0.0
}
});
}
}, {
text : 'Grand Canyon of PA',
onselect : function() {
viewer.scene.camera.flyTo({
destination : Cesium.Cartesian3.fromRadians(-1.349379633251472, 0.720297672225785, 656.268309953562),
orientation : {
heading : Cesium.Math.toRadians(200),
pitch : Cesium.Math.toRadians(-5),
roll : 0.0
}
});
}
}], 'toolbar');

一些地形数据配置和格式

本文结束感谢您的阅读,本文原创–支持原创
顺便打点赏吧~ 有问题请联系我--strivedeer@163.com