使用官方github包,部分解釋來源于http://cesium.xin/cesium/cn/Documentation1.95/index.html
Cesium.Ion.defaultAccessToken =token; constviewer = newCesium.Viewer("cesiumContainer", { shouldAnimate: true, //時鐘應該默認嘗試提前模擬時間,則為 true,否則為 false , }); functiondataCallback(interval, index) { lettime; if (index === 0) { time = Cesium.JulianDate.toIso8601(interval.stop); // JulianDate 表示天文儒略日期 // toIso 創建所提供日期的 ISO8601 表示, } else { time = Cesium.JulianDate.toIso8601(interval.start); } return { Time: time, }; } consttimes = Cesium.TimeIntervalCollection.fromIso8601({ //從 ISO 8601 時間間隔(開始/結束/持續時間)創建一個新實體 iso8601: "2015-07-30/2017-06-16/P1D", // ISO 8601 間隔, leadingInterval: true, // isStartIncluded:true, // true 開始時間包含在間隔中 trailingInterval: true, //要添加從停止時間到 Iso8601.MAXIMUM_VALUE 的間隔, //則為 true,否則為 false , isStopIncluded: false, //true 結束時間包含在間隔中 dataCallback: dataCallback, }); constprovider = newCesium.WebMapTileServiceImageryProvider({ //提供由 Web 地圖服務 (WMS) 服務器托管的平鋪影像, url: "https://gibs.earthdata.nasa.gov/wmts/epsg4326/best /MODIS_Terra_CorrectedReflectance_TrueColor/default/{Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg", layer: "MODIS_Terra_CorrectedReflectance_TrueColor", // 要包含的層,用逗號分隔, style: "default", tileMatrixSetID: "250m", maximumLevel: 5, //影像提供者支持的最大細節級別, //如果沒有限制,則未定義,如果未指定,則沒有限制, format: "image/jpeg", clock:viewer.clock, //在確定時間維度的值時使用的 Clock 實體,指定 `times` 時需要 times: times, // TimeIntervalCollection //及其資料屬性是一個包含時間動態維度及其值的物件, credit: "NASA Global Imagery Browse Services for EOSDIS", }); constlayer = newCesium.ImageryLayer(provider); //一個影像層,它在 Globe 上顯示來自單個影像提供者的平鋪影像資料 layer.alpha = 0.5; //透明度 viewer.imageryLayers.add(layer);
conststart = Cesium.JulianDate.fromIso8601("2015-07-30"); conststop = Cesium.JulianDate.fromIso8601("2017-06-17"); viewer.timeline.zoomTo(start, stop); //將視圖設定為提供的時間, constclock =viewer.clock; //獲取時鐘 clock.startTime = start; clock.stopTime = stop; clock.currentTime = start; //當前時間 clock.clockRange = Cesium.ClockRange.LOOP_STOP; //確定達到 Clock#startTime 或 Clock#stopTime 時時鐘的行為方式 //unbounded不變方向 單向流逝 //clamped 到地方就停止(start or stop/time) //loop_stop回圈 clock.multiplier = 7200;//默認倍率 //確定呼叫 Clock#tick 時提前多少時間,負值允許向后推進, 運行結果圖
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/549249.html
標籤:其他
