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