Cesium 案例(二)Web MapTile Service with Time

打印 上一主题 下一主题

主题 552|帖子 552|积分 1656

使用官方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 时提前多少时间,负值允许向后推进。  运行结果图 
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

科技颠覆者

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表