使用官方github包,部分解释来源于http://cesium.xin/cesium/cn/Documentation1.95/index.html
Cesium
.
Ion
.
defaultAccessToken
=
token;
const
viewer
=
new
Cesium
.
Viewer
(
“cesiumContainer”
, {
shouldAnimate
:
true
,
//时钟应该默认尝试提前模拟时间,则为 true,否则为 false 。
});
function
dataCallback
(
interval
,
index
) {
let
time
;
if
(
index
===
0
) {
time
=
Cesium
.
JulianDate
.
toIso8601
(
interval
.
stop
);
// JulianDate 表示天文儒略日期
// toIso 创建所提供日期的 ISO8601 表示。
}
else
{
time
=
Cesium
.
JulianDate
.
toIso8601
(
interval
.
start
);
}
return
{
Time
:
time
,
};
}
const
times
=
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
,
});
const
provider
=
new
Cesium
.
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”
,
});
const
layer
=
new
Cesium
.
ImageryLayer
(
provider
);
//一个图像层,它在 Globe 上显示来自单个图像提供者的平铺图像数据
layer
.
alpha
=
0.5
;
//透明度
viewer
.
imageryLayers
.
add
(
layer
);
const
start
=
Cesium
.
JulianDate
.
fromIso8601
(
“2015-07-30”
);
const
stop
=
Cesium
.
JulianDate
.
fromIso8601
(
“2017-06-17”
);
viewer
.
timeline
.
zoomTo
(
start
,
stop
);
//将视图设置为提供的时间。
const
clock
=
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 时提前多少时间,负值允许向后推进。 运行结果图
如有侵犯您的版权,请及时联系3500663466#qq.com(#换@),我们将第一时间删除本站数据。
暂无评论内容