1、构建一个viewer,如下创建;options的参数根据实际情况,进行设定
1 var viewer = new Cesium.Viewer(‘cesiumContainer‘, { 2 //Start in Columbus Viewer 3 sceneMode : Cesium.SceneMode.COLUMBUS_VIEW, // 设定3维地图的默认场景模式 4 //Use standard Cesium terrain 5 terrainProvider : new Cesium.CesiumTerrainProvider({ // 构建地形服务 6 url : ‘//cesiumjs.org/smallterrain‘, 7 credit : ‘Terrain data courtesy Analytical Graphics, Inc.‘ 8 }), 9 * //Hide the base layer picker 10 * baseLayerPicker : false, // 设定基本图层提供不显示 11 * //Use OpenStreetMaps 12 * imageryProvider : new Cesium.OpenStreetMapImageryProvider({ // 调用openstreetmap瓦片服务 13 * url : ‘//a.tile.openstreetmap.org/‘ 14 * }), 15 * // Use high-res stars downloaded from https://github.com/AnalyticalGraphicsInc/cesium-assets 16 * skyBox : new Cesium.SkyBox({ // 设定近焦点和远焦点的x、y、z 17 * sources : { 18 * positiveX : ‘stars/TychoSkymapII.t3_08192x04096_80_px.jpg‘, 19 * negativeX : ‘stars/TychoSkymapII.t3_08192x04096_80_mx.jpg‘, 20 * positiveY : ‘stars/TychoSkymapII.t3_08192x04096_80_py.jpg‘, 21 * negativeY : ‘stars/TychoSkymapII.t3_08192x04096_80_my.jpg‘, 22 * positiveZ : ‘stars/TychoSkymapII.t3_08192x04096_80_pz.jpg‘, 23 * negativeZ : ‘stars/TychoSkymapII.t3_08192x04096_80_mz.jpg‘ 24 * } 25 * }), 26 * // Show Columbus View map with Web Mercator projection 27 * mapProjection : new Cesium.WebMercatorProjection() // 设定投影坐标 28 * });
var viewer = new