Code Monkey home page Code Monkey logo

Comments (5)

woodbri avatar woodbri commented on May 9, 2024

I changed to use the esm version but with the same results. But I think I resolved this issue by making the following changes:

In wind-layer/dist/OlWindy.esm.js:11 by changing it to:

import { get as getProj, transformExtent } from 'ol/proj';

and changing L844 to be:

this.getSource().projection_ = getProj(this._getProjectionCode());

Now I don't get the above error, but when I turn on the animation, it runs while tiles are loading, but stops when all the tiles have loaded. If zoom or pan and new tiles are loaded the animation starts and runs as long as tiles are loading.

Any help would be greatly appreciated.

from wind-layer.

woodbri avatar woodbri commented on May 9, 2024

One additional piece of info is that I get please create new instance messages in the console log, which I just noticed are generated from OlWindy.setData() function, so I'm guessing I'm not using the API correctly. What is the correct way to turn on/off/clear the Windy layer, and what steps to I need to take to reload new data.

from wind-layer.

sakitam-fdd avatar sakitam-fdd commented on May 9, 2024

@woodbri

  1. Can you provide the openlayers version you are using? As far as I know, there's something about projection for openlayers v6.
  2. setData method must after appendTo method,When you just want to clear the layer, you can use the clearWind
    method, setData method for reload new data. Use removeLayer only when you really want to remove layers
function toggleWindy() {
    if ($(this).prop('checked')) {
        if (windData) {
            windy.appendTo(map);
            windy.setData(windData);
        }
    }
    else {
        windy.clearWind();
    }
}

from wind-layer.

woodbri avatar woodbri commented on May 9, 2024
  "dependencies": {
    "chart.js": "^2.9.3",
    "core-js": "^3.6.3",
    "jquery": "^3.4.1",
    "jquery-modal": "^0.9.2",
    "ol": "^5.3.3",
    "ol-layerswitcher": "github:woodbri/ol-layerswitcher#addcontrol",
    "ol-popup": "^4.0.0",
    "sidebar-v2": "github:umbe1987/sidebar-v2#ol5-sidebar",
    "wind-layer": "^0.1.1"
  },
  "devDependencies": {
    "parcel-bundler": "^1.12.4"
  }

from wind-layer.

woodbri avatar woodbri commented on May 9, 2024

OK, changing toggleWindy the way you have it improves things, now when I toggle it on the first time, the wind starts and runs as expected but I still get the please create new instance warning in the console. When I toggle it off it starts, but the next time I toggle it back on again it displays the wind but it is not animated and I get this uncaught exception error:

uncaught exception: AssertionError: Assertion failed. 
See https://openlayers.org/en/v5.3.3/doc/errors/#58 for details.
Collection.js:281:14
    assertUnique_ Collection.js:281
    push Collection.js:202
    addLayer PluggableMap.js:502
    setData index.js:76
    toggleWindy index.js:427
    jQuery 2

EDIT: I fixed this by moving the appendTo() out of the on/off control and placing it after the windy layer definition. So it looks to be working with only the change in defining the projection object.

from wind-layer.

Related Issues (20)

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.