Giter VIP home page Giter VIP logo

sakitam-fdd / wind-layer Goto Github PK

View Code? Open in Web Editor NEW
480.0 14.0 130.0 125.64 MB

:flags: :rocket: wind-layer | a openlayers && maptalks && amap && bmap && leaflet && mapbox-gl && maplibre-gl extension like windy.com for weather visualization

Home Page: https://sakitam-fdd.github.io/wind-layer/

License: Other

JavaScript 3.37% HTML 0.12% TypeScript 90.63% GLSL 5.86% Shell 0.02%
windy openlayers openlayers-extension wind-layer grib2 koa2 nodejs amap bmap docker

wind-layer's Issues

amap wind

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

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

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

高德地图下问题

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

ol6.2.1使用错误

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

高德地图: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

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

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');
    };
    下面贴上我的部分代码

BUG: setData

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

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)

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

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.

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

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?

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.

修改数据精度为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'

}
`

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>
    );
  }
}

高德地图的问题

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

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)

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

高德地图下缩放和移动

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

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.