Windy Community

    • Register
    • Login
    • Search
    • Unread
    • Categories
    • Groups
    • Go to windy.com
    1. Home
    2. abilek
    A
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 7
    • Best 4
    • Controversial 0
    • Groups 0

    abilek

    @abilek

    4
    Reputation
    231
    Profile views
    7
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    abilek Unfollow Follow

    Best posts made by abilek

    • Redrawing or reinitialising windyAPI in a single page app

      Hi there,

      I am evaluating windyAPI for (paid) use in a single page app. I'm trying to figure out the best way to redraw or reinitialise the map once I've navigated away so that < div id="windy" > has disappeared from the DOM.

      When I navigate back < div id="windy" > is again part of the DOM but needs to have windyAPI reinitialised. When I try to rerun windyInit, I get many errors along the lines of "tinyrequire DI error: Object W.glAnimation already exists" "tinyrequire DI error: Object W.glVector already exists"

      Is there a way to reset W back to preinit state?

      Thanks,
      Anne

      posted in Windy API v4
      A
      abilek
    • RE: Redrawing or reinitialising windyAPI in a single page app

      Interesting. The code I'm running is something along the lines of

      # if !copy_of_W
      #    copy_of_W = _.extend({}, W)
      # if W.windyBoot
      #    W = _.extend({}, copy_of_W)
      
      windyInit(options, (windyAPI) ->
          { map } = windyAPI
          lat = track.points[0].latitude
          lon = track.points[0].longitude
          L.marker([lat, lon], { title: track.aircraft }).addTo( map )
          pointsArray = []
          _.forEach(track.points, (point) ->
              pointsArray.push([point.latitude, point.longitude])
          )
          L.polyline(pointsArray, { color: 'red' }).addTo( map )
      )
      

      The first time the route loads, everything works like a charm. If I navigate to a different route then back again, windy reloads in the default view, with no options and no markers, and the following console errors

      0_1534840448792_Screen Shot 2018-08-21 at 8.31.49 PM.png

      If I uncomment

      if !copy_of_W
          copy_of_W = _.extend({}, W)
      if W.windyBoot
          W = _.extend({}, copy_of_W)
      

      windy reloads as expected, with the options and the markers etc.

      posted in Windy API v4
      A
      abilek
    • RE: Calls to https://api4.windy.com/api4/auth timing out after 30 secs

      @ivo thanks for sorting it so quickly :)

      posted in Windy API v4
      A
      abilek
    • RE: Redrawing or reinitialising windyAPI in a single page app

      Follow up solution for this issue is to copy the preinit W global somewhere, then reset W from that copy before reinitialising. I put something similar to this snippet before my call to windyInit()

      if (!window.copy_of_W) {
      window.copy_of_W = Object.assign({}, window.W);
      }
      if (window.W.windyBoot) {
      window.W = Object.assign({}, window.copy_of_W);
      }

      Hope this helps someone.

      posted in Windy API v4
      A
      abilek

    Latest posts made by abilek

    • RE: How to use it with Angular 6?

      This might help https://community.windy.com/topic/6503/redrawing-or-reinitialising-windyapi-in-a-single-page-app

      They don't seem to have a method to reinitialise but the hack listed there should work.

      posted in Windy API v4
      A
      abilek
    • Feature request: set level with consistent units, preferably meters

      Hi there

      We are using your product to track airplanes - our points give us latitude, longitude, and altitude (in meters).

      Looking at the availLevels array, the units aren't consistent - you can pass 100m but any higher altitudes have to be set in hPa, which not only requires additional logic but what looks like a really complicated calculation to convert meters to hPa.

      I notice that when you are setting the levels with the UI, hPa are mapped to meters anyway. Is it possible to set the level based on meters?

      Thanks for a really nice product.

      Cheers
      Anne

      posted in Windy API v4
      A
      abilek
    • RE: Calls to https://api4.windy.com/api4/auth timing out after 30 secs

      @ivo thanks for sorting it so quickly :)

      posted in Windy API v4
      A
      abilek
    • RE: Redrawing or reinitialising windyAPI in a single page app

      Interesting. The code I'm running is something along the lines of

      # if !copy_of_W
      #    copy_of_W = _.extend({}, W)
      # if W.windyBoot
      #    W = _.extend({}, copy_of_W)
      
      windyInit(options, (windyAPI) ->
          { map } = windyAPI
          lat = track.points[0].latitude
          lon = track.points[0].longitude
          L.marker([lat, lon], { title: track.aircraft }).addTo( map )
          pointsArray = []
          _.forEach(track.points, (point) ->
              pointsArray.push([point.latitude, point.longitude])
          )
          L.polyline(pointsArray, { color: 'red' }).addTo( map )
      )
      

      The first time the route loads, everything works like a charm. If I navigate to a different route then back again, windy reloads in the default view, with no options and no markers, and the following console errors

      0_1534840448792_Screen Shot 2018-08-21 at 8.31.49 PM.png

      If I uncomment

      if !copy_of_W
          copy_of_W = _.extend({}, W)
      if W.windyBoot
          W = _.extend({}, copy_of_W)
      

      windy reloads as expected, with the options and the markers etc.

      posted in Windy API v4
      A
      abilek
    • RE: Calls to https://api4.windy.com/api4/auth timing out after 30 secs

      I am also experiencing this issue, with Chrome complaining about "Cross-Origin Read Blocking (CORB) blocked cross-origin response https://api4.windy.com/api4/auth with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details." on line 2 of libBoot.js

      posted in Windy API v4
      A
      abilek
    • RE: Redrawing or reinitialising windyAPI in a single page app

      Follow up solution for this issue is to copy the preinit W global somewhere, then reset W from that copy before reinitialising. I put something similar to this snippet before my call to windyInit()

      if (!window.copy_of_W) {
      window.copy_of_W = Object.assign({}, window.W);
      }
      if (window.W.windyBoot) {
      window.W = Object.assign({}, window.copy_of_W);
      }

      Hope this helps someone.

      posted in Windy API v4
      A
      abilek
    • Redrawing or reinitialising windyAPI in a single page app

      Hi there,

      I am evaluating windyAPI for (paid) use in a single page app. I'm trying to figure out the best way to redraw or reinitialise the map once I've navigated away so that < div id="windy" > has disappeared from the DOM.

      When I navigate back < div id="windy" > is again part of the DOM but needs to have windyAPI reinitialised. When I try to rerun windyInit, I get many errors along the lines of "tinyrequire DI error: Object W.glAnimation already exists" "tinyrequire DI error: Object W.glVector already exists"

      Is there a way to reset W back to preinit state?

      Thanks,
      Anne

      posted in Windy API v4
      A
      abilek