Giter VIP home page Giter VIP logo

Comments (10)

sakitam-fdd avatar sakitam-fdd commented on May 14, 2024 2

@slarosa Will be fixed in the next version

from wind-layer.

sakitam-fdd avatar sakitam-fdd commented on May 14, 2024 1

@slarosa Try v1.0.0-alpha.3

from wind-layer.

sakitam-fdd avatar sakitam-fdd commented on May 14, 2024 1

@slarosa For this question, you may be interested in external and globals of rollup. You can see some code in:

  1. https://github.com/sakitam-fdd/wind-layer/blob/master/rollup/external/ol.js
  2. https://github.com/sakitam-fdd/wind-layer/blob/master/packages/ol/src/renderer.ts#L5
  3. https://github.com/sakitam-fdd/wind-layer/blob/master/packages/ol/src/renderer.ts#L14

with official OL6 library, ol.proj and ol.transform some of the modules used are not exposed,I just modified some things according to the official documents to expose these modules.

For example, add @api under the required function annotation:
https://github.com/openlayers/openlayers/blob/master/src/ol/transform.js#L35

/**
 * Resets the given transform to an identity transform.
 * @param {!Transform} transform Transform.
 * @return {!Transform} Transform.
 * @api
 */
export function reset(transform) {
  return set(transform, 1, 0, 0, 1, 0, 0);
}

from wind-layer.

slarosa avatar slarosa commented on May 14, 2024

@sakitam-fdd thanks.

It seems is not enough to change version to the source of the script tag. I done it but it has not worked.

Anyway, I tried the following different way:

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol-wind.min.js"></script>

but i get TypeError: OlWind is not a constructor

Also it throws the error:

ol-wind.min.js:23 Uncaught TypeError: Object prototype may only be an Object or null: undefined
    at setPrototypeOf (<anonymous>)
    at s (ol-wind.min.js:23)
    at a (ol-wind.min.js:23)
    at ol-wind.min.js:44
    at ol-wind.min.js:44
    at ol-wind.min.js:8
    at ol-wind.min.js:8

Any hint?

Thank you.

from wind-layer.

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

@slarosa There are some changes to the API for the new version,Here are some minimal examples https://codesandbox.io/s/map-ol-wind-2vc8v.
In addition, for the new version of OL, it may rely more on packaging tools, and may not be very friendly to CDN references, and for OL, there are many internal functions that are not exposed, so it is difficult to be compatible.

from wind-layer.

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

Use custom build-legacy build ol packages, Here's a simple example https://codepen.io/sakitam-fdd/pen/NWGOBoj

from wind-layer.

slarosa avatar slarosa commented on May 14, 2024

Thank you for your help @sakitam-fdd .

It now is working well. So I don't know why before it was not working.

<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/ol-wind.js"></script>

fetch('https://danwild.github.io/leaflet-velocity/wind-global.json')
        .then(res => res.json())
        .then(res => {
            var wind = new WindLayer(res, {
                title: 'Wind',
                visible: false,
                wrapX: true,
                forceRender: false,
                windOptions: {
                    addLayer: true,
                    globalAlpha: 0.8,
                    maxAge: 90,
                    velocityScale: 0.01,
                    paths: 2000,
                    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: 3,
                },

            });

            map.addLayer(wind);
        });

However, I now have another problem but it concerns another topic so I will open a new issue for it.

Thanks much for the amazing job

from wind-layer.

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

@slarosa For the previous error, you can use codepen or codesandbox to give me a simple example, I will check it out tomorrow

from wind-layer.

slarosa avatar slarosa commented on May 14, 2024

@sakitam-fdd here a simple example which shows the previous error. https://codepen.io/slarosa/pen/yLYQzad

If the javascript source links to //cdn.jsdelivr.net/npm/@sakitam-gis/[email protected]/dist/ol.js your own OL6 library (6.3.3) all works fine. While with official OL6 library (6.3.1 as in codepen) it does not work.

from wind-layer.

slarosa avatar slarosa commented on May 14, 2024

@sakitam-fdd thank you so much for the exhaustive explanation.

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.