2025-03-29 01:30:00 +00:00
|
|
|
|
<!--********************************************************************
|
|
|
|
|
* by jiawanlong
|
|
|
|
|
*********************************************************************-->
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8" />
|
|
|
|
|
<link rel="stylesheet" href="./../../libs/cesium/Cesium1.98/Widgets/widgets.css">
|
|
|
|
|
<script type="text/javascript" src="./../../libs/cesium/Cesium1.98/Cesium.js"></script>
|
|
|
|
|
<script src="./echarts/5.4.3/echarts.min.js"></script>
|
|
|
|
|
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0">
|
|
|
|
|
<div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div>
|
|
|
|
|
<div style=" position: absolute;bottom: 150px; width: 100%; left: 0%; z-index: 1000;">
|
|
|
|
|
<div id="timelines" style="width: 100%;height:50px;"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style=" position: absolute;
|
|
|
|
|
right: 0;
|
|
|
|
|
bottom: 32px;
|
|
|
|
|
z-index: 100;
|
|
|
|
|
background: #373434fa;
|
|
|
|
|
color: white;
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
">
|
|
|
|
|
<p id="times" style=" font-size: 24px;"></p>
|
|
|
|
|
<p>注:数据来源于中央气象台与国家气象信息中心,中国天气网制图</p>
|
|
|
|
|
</div>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
2025-05-18 11:30:00 +00:00
|
|
|
|
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjM2EzNGJmNy02N2RmLTQ0MDMtYjI2MS1hZTJiMTIwZGYwMTYiLCJpZCI6MzA0MzEyLCJpYXQiOjE3NDc3MjM3MTV9.ePQNhuoVuDsi_z00lTm5W26wyW1Adcr1AWetGM6WSXI'
|
2025-03-29 01:30:00 +00:00
|
|
|
|
const viewer = new Cesium.Viewer('map', {});
|
|
|
|
|
|
|
|
|
|
axios.get('https://gswarn.weather.com.cn/app/api/cn_scw_radar_cloud?type=satellite')
|
|
|
|
|
.then((response) => {
|
|
|
|
|
init(response.data.l);
|
|
|
|
|
})
|
|
|
|
|
function init(ddd) {
|
|
|
|
|
let arr1 = []
|
|
|
|
|
let arr2 = []
|
|
|
|
|
ddd.forEach((k)=>{
|
|
|
|
|
arr1.push(k.l1)
|
|
|
|
|
arr2.push(k.l2)
|
|
|
|
|
})
|
|
|
|
|
arr1 = arr1.reverse()
|
|
|
|
|
arr2 = arr2.reverse()
|
|
|
|
|
|
|
|
|
|
let arrTileLayer = [];
|
|
|
|
|
const urlArr = arr2;
|
|
|
|
|
for (let i = 0, len = urlArr.length; i < len; i++) {
|
|
|
|
|
var imageryProvider = new Cesium.SingleTileImageryProvider({
|
|
|
|
|
url: urlArr[i],
|
|
|
|
|
rectangle: Cesium.Rectangle.fromDegrees(63.05754, 4.432541, 136.963346, 54.174859),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let options = {
|
|
|
|
|
alpha: 0
|
|
|
|
|
}
|
|
|
|
|
var imageryLayer = new Cesium.ImageryLayer(imageryProvider, options);
|
|
|
|
|
viewer.imageryLayers.add(imageryLayer)
|
|
|
|
|
|
|
|
|
|
arrTileLayer.push(imageryLayer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var myChart = echarts.init(document.getElementById('timelines'));
|
|
|
|
|
|
|
|
|
|
// echarts时间轴,超级强大!
|
|
|
|
|
var option = {
|
|
|
|
|
baseOption: {
|
|
|
|
|
timeline: {
|
|
|
|
|
axisType: 'category',
|
|
|
|
|
autoPlay: true,
|
2025-04-12 01:30:00 +00:00
|
|
|
|
playInterval: 100,
|
2025-03-29 01:30:00 +00:00
|
|
|
|
data: arr1,
|
|
|
|
|
label: {
|
|
|
|
|
formatter: function (s) {
|
|
|
|
|
return new Date(s).getHours() + "-" + new Date(s).getSeconds()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
myChart.setOption(option);
|
|
|
|
|
|
|
|
|
|
myChart.on('timelinechanged', function (event) {
|
|
|
|
|
// console.log('当前:', event);
|
|
|
|
|
// console.log('当前索引:', event.currentIndex);
|
|
|
|
|
document.getElementById('times').innerHTML = "当前时间: "+ arr1 [event.currentIndex]
|
|
|
|
|
closeAll();
|
|
|
|
|
arrTileLayer[event.currentIndex].alpha = 1;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function closeAll() {
|
|
|
|
|
arrTileLayer.forEach((k, i) => {
|
|
|
|
|
arrTileLayer[i].alpha = 0;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
viewer.camera.flyTo({
|
|
|
|
|
destination: Cesium.Cartesian3.fromDegrees(110.511154, 29.362943, 5531517.4),
|
|
|
|
|
duration: 2,
|
|
|
|
|
orientation: {
|
|
|
|
|
heading: Cesium.Math.toRadians(348.3), // 水平旋转,围绕Y轴,0为正北方向
|
|
|
|
|
pitch: Cesium.Math.toRadians(-89.8), // 上下旋转,围绕X轴,-90为俯视地面
|
|
|
|
|
roll: 0.0 // 视口的翻滚角度,围绕Z轴,0为不翻转
|
|
|
|
|
},
|
|
|
|
|
complete: () => {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
</html>
|