Code Monkey home page Code Monkey logo

wind-layer's Introduction

wind-layer

a maptalks | mapbox-gl | openlayers | leaflet | bmap | amap extension to show wind field。

介绍

wind-layer 是一个专注于气象格点数据可视的插件,设计之处是参考了 earth cambecc 的一个气象数据的展示,他使用了流体场的方式去展示了全球的风速和风向,富有很强的 表现力, 这个插件的早期的很多核心代码也是来源于此。当然现在它不仅仅是做风场的展示,常规的气象数据都可以依赖此插件进行可视化。

特性 (1.x 通用版本相对于原始 windy.js)

  • 易于配置粒子数量,原始 windy.js 只能给定一个系数,会根据地图元素的大小进行计算粒子数量;现在可以支持系数方式和固定粒子数量以及回调函数的的三种方式。
  • 颜色配置支持三种方式: String:固定颜色值 Function: 通过回调函数的风速值设定颜色(但是会有一定的性能损失) String[]: 按照风速值范围等间隔渲染,无法做到精确匹配对应值的颜色。
  • 线条宽度支持动态设置。
  • 抽离了核心渲染库,便于扩展到其他地图渲染库。

2.x webgl 版本

gl-core扩展目前只针对 mapboxmaplibremaptalks 做了相关适配,其他引擎适配欢迎 PR。

目前计划支持的图层如下:

  • 常规 raster 图层,为了解决多时次瓦片序列播放问题。
  • 常规 Image 图层,单张 raster 图层。
  • 色斑图渲染,支持瓦片和单张。
  • 多数据源支持(geotiff、灰度图-可解析带 exif 信息、png-多通道浮点数压缩)。
    • geotiff 的支持需要配置 configDeps, exif 默认支持,因为在 safari 浏览器下 configDeps 有兼容性问题,所以默认打包了 exif 的解析库。
    mapboxWind.configDeps(['https://unpkg.com/geotiff/dist-browser/geotiff.js']);
  • TimelineSource(时序数据源)支持。
  • 粒子渲染,支持瓦片和单张。
  • 箭头图层,支持瓦片和单张(矢量数据:风或洋流)。
  • 图层拾取。
  • 图层掩膜。

TIP: 注意 2.0 之后不再支持 jsonArray 数据和 EPSG:4326 的图片数据,如果有需求请使用 1.x 版本

wind-animation.mp4
animation.mp4
arrow.mp4
poc.mp4

示例图片

wind

扩展

Project Version Npm CDN Description
wind-core Npm package NPM downloads 风场核心渲染,可扩展不可以直接使用
wind-gl-core Npm package NPM downloads 色斑图核心渲染,可扩展不可以直接使用
ol-wind Npm package NPM downloads openlayers 6+ 风场扩展插件
ol5-wind Npm package NPM downloads openlayers 5 风场扩展插件
openlayers-wind Npm package NPM downloads openlayers 3/4 风场扩展插件
@sakitam-gis/maptalks-wind Npm package NPM downloads maptalks 风场扩展插件
amap-wind Npm package NPM downloads 高德地图风场扩展插件
bmap-wind Npm package NPM downloads 百度地图风场扩展插件
mapbox-wind Npm package NPM downloads mapbox-gl 风场扩展插件
maplibre-wind Npm package NPM downloads maplibre-gl 风场扩展插件
leaflet-wind Npm package NPM downloads Leaflet风场扩展插件

特殊说明

cesium 相关集成请查看 cesium-wind

安装

使用 pnpm 或 yarn 安装

我们推荐使用 pnpm 或 yarn 的方式进行开发, 不仅可在开发环境轻松调试,也可放心地在生产环境打包部署使用, 享受整个生态圈和工具链带来的诸多好处。

相关插件:

# pnpm
pnpm install wind-core
pnpm install wind-gl-core
pnpm install src-wind
pnpm install ol5-wind
pnpm install openlayers-wind
pnpm install @sakitam-gis/maptalks-wind
pnpm install amap-wind
pnpm install bmap-wind
pnpm install leaflet-wind
pnpm install @sakitam-gis/mapbox-wind
pnpm install @sakitam-gis/maplibre-wind

# yarn
yarn add wind-core
yarn add wind-gl-core
yarn add src-wind
yarn add ol5-wind
yarn add openlayers-wind
yarn add @sakitam-gis/maptalks-wind
yarn add amap-wind
yarn add bmap-wind
yarn add leaflet-wind
yarn add @sakitam-gis/mapbox-wind
yarn add @sakitam-gis/maplibre-wind

部分插件亦可以通过浏览器引入

在浏览器中使用 script 标签直接引入文件,并使用全局变量。

我们在仓库发布包内的 dist 目录下提供了 xxx.js 以及 xxx.min.js

Project unpkg jsdelivr
wind-core https://unpkg.com/wind-core/dist/wind-core.js https://cdn.jsdelivr.net/npm/wind-core/dist/wind-core.js
wind-gl-core https://unpkg.com/wind-gl-core/dist/wind-gl-core.js https://cdn.jsdelivr.net/npm/wind-gl-core/dist/wind-gl-core.js
ol-windol6 重构原因,无法直接使用,你可以自行构建https://cdn.jsdelivr.net/npm/@sakitam-gis/[email protected]/dist/ https://unpkg.com/ol-wind/dist/ol-wind.js https://cdn.jsdelivr.net/npm/ol-wind/dist/ol-wind.js
ol5-wind https://unpkg.com/ol5-wind/dist/ol-wind.js https://cdn.jsdelivr.net/npm/ol5-wind/dist/ol-wind.js
openlayers-wind https://unpkg.com/openlayers-wind/dist/ol-wind.js https://cdn.jsdelivr.net/npm/openlayers-wind/dist/ol-wind.js
@sakitam-gis/maptalks-wind https://unpkg.com/@sakitam-gis/maptalks-wind/dist/maptalks-wind.js https://cdn.jsdelivr.net/npm/@sakitam-gis/maptalks-wind/dist/maptalks-wind.js
amap-wind https://unpkg.com/amap-wind/dist/amap-wind.js https://cdn.jsdelivr.net/npm/amap-wind/dist/amap-wind.js
bmap-wind https://unpkg.com/bmap-wind/dist/bmap-wind.js https://cdn.jsdelivr.net/npm/bmap-wind/dist/bmap-wind.js
leaflet-wind https://unpkg.com/leaflet-wind/dist/leaflet-wind.js https://cdn.jsdelivr.net/npm/leaflet-wind/dist/leaflet-wind.js
@sakitam-gis/mapbox-wind https://unpkg.com/@sakitam-gis/mapbox-wind/dist/mapbox-wind.js https://cdn.jsdelivr.net/npm/@sakitam-gis/mapbox-wind/dist/mapbox-wind.js
@sakitam-gis/maplibre-wind https://unpkg.com/@sakitam-gis/maplibre-wind/dist/maplibre-wind.js https://cdn.jsdelivr.net/npm/@sakitam-gis/maplibre-wind/dist/maplibre-wind.js

基础

基础使用可以分为三步:

  1. 引入相应的 WebGIS 地图类库,引入对应的可视化图层扩展插件。
  2. 正常初始化一个地图。
  3. 创建一个 WindLayer,设置风场格点的 U V 数据和图层参数 并添加到地图上。

示例

以下以 maptalks 为例:

npm + es6

<template>
  <div class="demo-content">
    <div class="demo-content-datgui"></div>
    <div class="map-warp" ref="map"></div>
  </div>
</template>
<script>
  import 'maptalks/dist/maptalks.css';
  import {
    Map,
    TileLayer,
  } from 'maptalks';

  import { WindLayer } from 'maptalks-wind';

  export default {
    name: 'maptalks-wind-base',
    data() {
      return {};
    },
    watch: {},
    methods: {
      initMap() {
        const map = new Map(this.$refs.map, {
          center: [113.53450137499999, 34.44104525],
          zoom: 3,
          baseLayer: new TileLayer('base', {
            urlTemplate: '//{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png',
            // urlTemplate: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
            subdomains: ['a', 'b', 'c', 'd'],
          })
        });

        fetch('/data/wind.json')
          .then(res => res.json())
          .then(res => {
            const windLayer = new WindLayer('wind', res, {
              windOptions: {
                // colorScale: scale,
                velocityScale: 1 / 20,
                paths: 5000,
                // eslint-disable-next-line no-unused-vars
                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)"
                ],
                // colorScale: scale,
              },
              // map: map,
              // projection: 'EPSG:4326'
            });

            console.log(map, windLayer);

            map.addLayer(windLayer);
          });
      }
    },
    mounted() {
      this.initMap();
    },
  };
</script>

<style lang="less">
  .demo-content {
    width: 100%;
    height: 100%;
    position: relative;
    background-color: #cbe0ff;
    &-datgui {
      position: absolute;
      top: 10px;
      left: 10px;
      z-index: 1;
      pointer-events: auto;
    }

    .map-warp {
      width: 100%;
      height: 100%;
    }
  }
</style>

cdn

<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Map - Display a map</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/maptalks/dist/maptalks.css">
<style type="text/css">
  html, body {
    margin: 0;
    height: 100%;
    width: 100%
  }
  .container {
    width: 100%;
    height: 100%
  }
</style>
<body>

<div id="map" class="container"></div>
<script src="https://cdn.jsdelivr.net/npm/maptalks/dist/maptalks.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@sakitam-gis/maptalks-wind/dist/maptalks-wind.js"></script>
<script>
  const map = new maptalks.Map('map', {
    center: [113.53450137499999, 34.44104525],
    zoom: 5,
    baseLayer: new maptalks.TileLayer('base', {
      // urlTemplate: 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png',
      urlTemplate: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
      subdomains: ['a', 'b', 'c', 'd'],
    })
  });

  fetch('data.json')
    .then(res => res.json())
    .then(res => {
      const windLayer = new MaptalksWind.WindLayer('wind', res, {
        windOptions: {
          // colorScale: (m) => {
          //   // console.log(m);
          //   return '#fff';
          // },
          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)"
          ],
          // velocityScale: 1 / 20,
          // paths: 5000,
          frameRate: 16,
          maxAge: 60,
          globalAlpha: 0.9,
          velocityScale: 1 / 30,
          // paths: 10000,
          paths: () => { // can be number or function
            const zoom = map.getZoom();
            return zoom * 1000;
          },
        },
      });

      console.log(map, windLayer);

      map.addLayer(windLayer);
    });
</script>
</body>
</html>

文档请移步 正在完善中......

如何获取数据

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

YYYYMMDD=<a date, for example: 20140101>
curl "http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs.pl?file=gfs.t00z.pgrb2.1p00.f000&lev_10_m_above_ground=on&var_UGRD=on&var_VGRD=on&dir=%2Fgfs.${YYYYMMDD}00" -o gfs.t00z.pgrb2.1p00.f000
grib2json -d -n -o current-wind-surface-level-gfs-1.0.json gfs.t00z.pgrb2.1p00.f000
cp current-wind-surface-level-gfs-1.0.json <earth-git-repository>/public/data/weather/current

对于 2.x 版本的数据格式我们可以使用 https://github.com/sakitam-gis/raster-process 来生成所需要的瓦片和单张图片。

Acknowledgments

License

FOSSA Status

wind-layer's People

Contributors

dependabot[bot] avatar fossabot avatar github-actions[bot] avatar moonassassin avatar petyaogurkin avatar sakitam-fdd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wind-layer's Issues

EPSG:4326数据导入问题!!!

大哥,我现在正在使用你的windLayer插件。
这个插件真是灰常牛逼,叹为观止。
我就想问问,这个插件能够加载EPSG:4326的数据吗?我看到测试数据out.json是EPSG:3857的,但是我使用国内的底图服务(4326),把ol.view设置成4326之后风场效果就乱了~
然后就是,大哥,上哪去下载EPSG:4326的风场数据啊,我现在在做这个效果,风场用的你的windLayer,飞行轨迹用的你的ol3Echarts。我搞了好几天了,不知道怎么去下载EPSG:4326的风场数据,好纠结。
求求大哥帮忙啊!!!跪谢了!!!要不大哥看能不能在GIT上面上传一个EPSG:4326的json数据?求求大哥了!!!我180°弯腰鞠躬了!!!

高德地图下缩放和移动

尝试了样例中的amap.html,在移动和缩放时,风场的位置偏移,也没有什么规律。
另外,移动时是否需要重绘?
不知道现在还有时间维护修复?也想参与修改,奈何GIS方面知识欠缺...
感谢!

Issue with OL 6.1.1

Hi, I am trying to add wind layer to my map by using the following example:

I add in my the script:

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/windLayer.js"></script>
<script type="text/javascript" src="index.js"></script>

and then I add layer definition in my main index.js:

$.getJSON('https://sakitam-fdd.github.io/wind-layer/data/wind.json', function (data) {
        var wind = new windLayer.OlWind(data, {
            layerName: 'windLayer',
            projection: 'EPSG:4326',
            devicePixelRatio: window.devicePixelRatio,
            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)'
            ],
            minVelocity: 0,
            maxVelocity: 10,
            velocityScale: 0.05,
            particleAge: 90,
            lineWidth: 1,
            particleMultiplier: 0.01
        });

        map.addLayer(wind);
});

The "wind" layer is not displayed and I see the following log error:

Layer.js:91 Uncaught TypeError: Cannot read property 'opacity' of undefined
    at e.useContainer (Layer.js:91)
    at e.renderFrame (TileLayer.js:225)
    at e.render (Layer.js:205)
    at e.renderFrame (Composite.js:110)
    at e.renderFrame_ (PluggableMap.js:1166)
    at e.<anonymous> (PluggableMap.js:186)

I also tried to add opacity option but I get the same error.

Any hint to get it working?

Thank you.

GPU.js is mentioned, can we get an example?

In the docs, translated, I see:

The particle Field and Vector Vector calculation code are extracted for easy extended calculation, such as using webworker or gpu.js acceleration.

Can we get an example of GPU.js usage?

Add support for Openlayers 6

Add support for current code under Openlayers 6, I'm getting the following error.

TypeError: Argument 1 of Node.appendChild does not implement interface Node. seecast-ol6.e31bb0bc.js:11134:12
    replaceChildren https://example.com/seecast-ol6.e31bb0bc.js:11134
    renderFrame https://example.com/seecast-ol6.e31bb0bc.js:38003
    renderFrame_ https://example.com/seecast-ol6.e31bb0bc.js:35575
    animationDelay_ https://example.com/seecast-ol6.e31bb0bc.js:34383
    <anonymous> self-hosted:876

This works under OpenLayers 5.3.3

Wind layer's width/height issue

Hi!
I have a problem with the wind layer's width and height. It takes just the 50% of the window width and height, even though the canvas width looks like it's the window's 100% width. I've tried fixing it with css, changing the projection, I've put console.logs in the OLWind.js file to see the width and height it is taking, but there's no way.

As you can see in the screenshot below, it's everything ok but the width and height:
imagen

When I resize the window it adjusts it's width and height, but it still gets fixed to 50%. The same happens to me with the example you put at jsfiddle...

Many thanks in advance, and thanks for the project development you're doing

feature:next version

Issue description

v1.0.0 正式版发布功能完成度:

To Do List:

  • Add label and assign to milestone
  • Coding
  • optimization
  • Test
  • Doc update
  • Whats new update

Please provide a reproduction URL (on any jsfiddle like site)

ol5-wind failed to render

I'm using ol5-wind and got this error with a very basic sample. (The same code worked with ol-wind, which is openlayers 6. But for some reason I need to use openlayers 5).

The error:

Uncaught (in promise) TypeError: data.checkFields is not a function
    at OlWind.push../node_modules/ol5-wind/dist/ol-wind.esm.js.OlWind.setData (Vertex.js:27)
    at new OlWind (Vertex.js:27)
    at map.tsx:35

package versions:
@types/[email protected]
[email protected]
[email protected] (Tried 5.3.3, didn't work either)
[email protected]

The code that reproduces the issue:

import * as React from 'react';
import 'ol/ol.css';
import { Map, View } from 'ol';
import { Tile as TileLayer } from 'ol/layer';
import { OSM } from 'ol/source';
import { WindLayer } from 'ol5-wind';
import './map.scss';

export default class MapX extends React.Component {
  mapDiv: any;

  constructor(props) {
    super(props);
  }

  componentDidMount() {
    const layer = new TileLayer({
      source: new OSM({
        url: '//{a-d}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png'
      })
    });

    const map = new Map({
      layers: [layer],
      target: this.mapDiv,
      view: new View({
        center: [0, 0],
        zoom: 2
      })
    });

    fetch('./content/data/wind.json')
      .then(res => res.json())
      .then(res => {
        const windLayer = new WindLayer(res, {
          forceRender: false,
          windOptions: {
            velocityScale: 1 / 20,
            paths: 5000,
            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)'
            ],
            lineWidth: 2,
            generateParticleOption: false
          }
        });
        map.addLayer(windLayer);
      });
  }

  render() {
    return (
      // Need this extra div to supress css of the parent
      <div>
        <div className="openlayers-map" ref={el => (this.mapDiv = el)} style={{ height: `${window.innerHeight - 132}px` }}>
          {this.props.children}
        </div>
      </div>
    );
  }
}

BUG: setData

should update data:
this.windLayer.wind.updateData(this.windLayer.field)

ol6.2.1使用错误

你好,我是ol6.2.1版本,使用wind-layer的ol-wind,然后按照示例进行,发现页面错误
1.风场的背景完完全把地图覆盖了,背景一片白色
2.地图移动风场保留在原来的地图上

amap wind

老哥,为啥高德地图不好使。。。。

Update npm dependencies

I just forked the repository and ran npm install it reported:

 found 21 vulnerabilities (3 low, 6 moderate, 11 high, 1 critical) in 7463 scanned packages

running npm audit fix does not resolve the issues. I'm reluctant to to force the fix as I don't really understand how or where all these packages are getting used.

woodbri@B1B8B6F:~/work/wind-layer$ npm audit fix
npm WARN [email protected] requires a peer of openlayers@^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of maptalks@^0.40.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint-plugin-node@>=7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint-plugin-promise@>=4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@>=2.0.0 <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

fixed 3 of 21 vulnerabilities in 7463 scanned packages
  17 vulnerabilities required manual review and could not be updated
  1 package update for 1 vulnerability involved breaking changes
  (use `npm audit fix --force` to install breaking changes; or refer to `npm audit` for steps to fix these manually)

TypeError: projection1.getUnits is not a function proj.js:399:33 using dist/OlWindy.js with npm

Hi, this is an awesome project! Thanks.

I'm using:

import OlWindy from 'wind-layer/dist/OlWindy.js';

var windy = new OlWindy(windData, {
    layerName: 'Wind Animation',
    title: 'Wind Animation',
    projection: 'EPSG:4326',
    devicePixelRatio: window.devicePixelRatio,
    map: map,
    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)"
    ],
    minVelocity: 0,
    maxVelocity: 10,
    velocityScale: 0.05,
    particleAge: 90,
    lineWidth: 1,
    particleMultiplier: 0.01,
});

// control to toggle windy on/off
function toggleWindy() {
    if ($(this).prop('checked')) {
        if (windData) {
            windy.removeLayer();
            windy.setData(windData);
            windy.appendTo(map);
        }
    }
    else {
        windy.clearWind();
        windy.removeLayer();
    }
}

$('input[name=animatewinds]').prop('checked', false);
$('input[name=animatewinds]').on('click', toggleWindy);

And windData is your out.json.

The problem appears to be that projection1 = 'EPSG:3857' instead of a projection object.
In Image.js:153, this is sourceProjection which comes from L149, const sourceProjection = this.getProjection()

This happens when I toggle on the animation using the above code.

TypeError: projection1.getUnits is not a function proj.js:399:33
    equivalent proj.js:399
    getImage Image.js:153
    prepareFrame ImageLayer.js:146
    renderFrame Map.js:157
    renderFrame_ PluggableMap.js:1226
    animationDelay_ PluggableMap.js:193
    <anonymous> self-hosted:876

Question on variable "date"

@sakitam-fdd I notice you have a variable "date" seen here:

https://github.com/sakitam-fdd/wind-layer/blob/master/dist/OlWindy.esm.js#L73
https://github.com/sakitam-fdd/wind-layer/blob/master/dist/OlWindy.esm.js#L138
https://github.com/sakitam-fdd/wind-layer/blob/master/dist/OlWindy.esm.js#L160

This does not seem to be used anywhere. Is this correct?

At L138, you expect header.refTime and header.forecastTime so I need to have them in my header in the json file. I'm asking because I am writing a python script to fetch gfs data from:

RES = '1p00'
YYYMMDD = utcnow.strftime("%Y%m%d")
HH = '{0:0>2}.format(int(int(utcnow.strftime("%H"))/6)*6)

URL = 'https://nomads.ncep.noaa.gov:9090/dods/gfs_{0}/gfs{1}/gfs_{0}_{2}z'.format(RES, YYYMMDD, HH)

And then generating the windy.json file so I can run in a crontab to generate an file that can be used to load the animation layer.

Error with openlayers 5.0.2

在使用过程中,发现这个过程不断的出错误。是我用的方式不对嘛?react 16.11.0 ol是5.0.2

错误:windLayer.esm.js:917 Uncaught (in promise) TypeError: this.get is not a function
at OlWind.getMap (windLayer.esm.js:917)
报错指向这个方法:/**

  • get map
    */
    OlWindy.prototype.getMap = function getMap () {
    return this.get('originMap');
    };
    下面贴上我的部分代码

修改数据精度为0.25没有任何变化

我看到你的代码里面精度是1.0,我自己获取了0.25精度的数据并转为json,然而并没有发现有任何变化?我如何能达到真气网那种效果,当把地图缩放到某个城市后能够看到更精确的风向?下面的参数是否需要变化?
`
requestParams: {

//lev_2_m_above_ground: 'on',

lev_10_m_above_ground: 'on',

//lev_surface: 'on',

// var_TMP: 'off',

var_UGRD: 'on',

var_VGRD: 'on',

subregion: 'on'

}
`

高德地图下问题

1、风场与地图的对应有点问题,拖动、放大地图,风场图层对应有问题
2、风场方向有疑问?相同数据源,使用leaflet绘制跟wind-layer风向不一样。
修改了js文件中的坐标系无变化
3、粒子颜色问题,拖尾颜色无法修改,始终是灰色

高德地图的问题

首先感谢大佬开源的这个插件,star先点上,然后我在使用中遇到一些问题,希望大佬可以提供一些帮助,非常感激:
1.高德地图的默认缩放等级为3-18,为什么使用例子里面的json文件发现在等级3-9好像不会显示风场,要10之后的才可以显示(data.json)
2.为什么地图中心移动到太平洋时也不能显示风场,要移动到其他地方风场才会正常显示?(例子中的高德地图例子)
3.大佬各个颜色代表什么的阿,我猜测和风速有关?不知道大佬你的配置颜色代表什么含义?大佬有这方面的资料推荐一下或者说明一下吗?
4.经纬度坐标问题,大佬,这个高德地图的风场的坐标是那个坐标系的?我了解的好像有地球坐标,火星坐标,百度的坐标?不是这方面的工作人员,所以不是很了解,对于高德地图版本使用的坐标大佬也可以推荐一些资料吗?

高德地图:3D模式下,渲染很卡顿

高德地图版本: 1.4.15
amap-wind版本: 1.0.0-alpha.6
wind-core版本:1.0.0-alpha.6

数据是使用的demo中的数据:https://sakitam-fdd.github.io/wind-layer/data/wind.json

地图在2D模式下,渲染位置正常,且不卡顿,但是在3D模式下,渲染就很卡,地图的相关操作也卡,例如放大缩小、拖动等。

这个在DEMO中好像也有问题: https://github.com/sakitam-fdd/wind-layer/blob/master/examples/amap.html

这个是什么原因导致的呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.