1.1.6 • Published 10 months ago

cesium-wind-canvas v1.1.6

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

cesium-wind-canvas

a cesium extension to show wind field.

# npm
npm install cesium-wind-canvas
addTo()添加视图
show()开启风场
hide()关闭风场
remove()移除风场
removeLayer()同 remove()同效果
setData()配置风场数据

npm + es6

<script>
  const map = new Cesium.Viewer("cesium");
  import CesiumWind from 'cesium-wind-canvas';
  const windOptions = {
    colorScale: [
       "rgb(36,104, 180)",
       "rgb(60,157, 194)",
       "rgb(128,205,193 )",
       "rgb(151,218,168 )",
       "rgb(198,231,181)",
       "rgb(238,247,217)",
       "rgb(255,238,159)",
       "rgb(252,217,125)",
       "rgb(255,182,100)",
       "rgb(252,150,75)",
       "rgb(250,112,52)",
       "rgb(245,64,32)",
       "rgb(237,45,28)",
       "rgb(220,24,32)",
       "rgb(180,0,35)"
    ],
    frameRate: 50,
    maxAge: 60,
    globalAlpha: 0.9,
    velocityScale: 1 / 30,
    paths: 2000,
  };
  // 获取风流场数据
  fetch("https://qjvic.github.io/cesium-wind/examples/wind.json")
    .then((res) => {
      if (!res.ok) {
        throw new Error("Network response was not ok");
      }
      return res.json();
    })
    .then((data) => {
        const wind = new CesiumWind(data, { windOptions });
        wind.addTo(map.viewer);
        wind.show() // 默认不开启
    })
    .catch((error) => {
      console.error(error);
    });

如何获取数据

天气数据由全球预报系统(GFS)生成, 由美国国家气象局管理。 预测每天产生四次,并可用于 从NOMADS下载。 这些文件位于GRIB2 格式并包含超过300 条记录。 我们只需要这些记录中的一小部分就可以在特定的等压线上可视化风资料。 下面的命令下载 1000 hPa 风向量,并使用grib2json将它们转换为 JSON 格式。

介绍

本项目基于 https://github.com/QJvic/cesium-wind 项目完成,使用设置(windOptions)及数据(data)与原项目一致。 已应用至实际项目中,请放心食用。

1.1.6

10 months ago

1.1.5

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.0

10 months ago