Windy Community
    • Unread
    • Categories
    • Groups
    • Go to windy.com
    • Register
    • Login

    Feature request

    Scheduled Pinned Locked Moved Windy API v4
    11 Posts 3 Posters 3.1k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      powellbound API developers
      last edited by

      The app I am working on has multiple markers on the page and I would love to be able to get the layer data after moving the time slider for those markers based on the LatLon of the markers. I have tried on redrawFinished to move the picker around to the spots to get the layer data but it is just not gonna work.

      A great to have (for me) would be an overlay.getData(lat, lon) method that would return the info that I could run anytime but especially on redrawFinished...

      Thanks for the great (make that GREAT) product you all are creating!!

      1 Reply Last reply Reply Quote 2
      • P Offline
        powellbound API developers
        last edited by

        An even better method would be one where I could get back data based on the overlay I pass in:

        Something like: overlay.getData(lat, lon, 'wind') or overlay.getData(lat, lon, 'temp') then it would not matter what overlay I was on...

        1 Reply Last reply Reply Quote 0
        • rittelsR Offline
          rittels Code contributor | Premium
          last edited by

          Good news:

          The interpolator function has been added in the latest API. Documented here:
          https://github.com/windycom/windy-plugins/tree/master/examples/09-reading-weather-values

          Thx Windy team!!

          P 1 Reply Last reply Reply Quote 1
          • P Offline
            powellbound API developers @rittels
            last edited by

            @rittels So, those are in Windy plugins, not the page API, right?

            I have never written a plugin. Do I need visual studio or ??

            1 Reply Last reply Reply Quote 0
            • rittelsR Offline
              rittels Code contributor | Premium
              last edited by

              Interpolator function has now been added to the API. However, it is not in the windyAPI object but in W.

              short example:

              const {interpolator} = W; 
                      broadcast.on("redrawFinished", e=>{
              
                          interpolator(interfun=>{
                              let mc=map.getCenter();    //pass your coords to the interpolator function
                              console.log("Weather at map center: ",  interfun({lat: mc.lat,lon: mc.lng}));
                          })
              
                      })
              
              1 Reply Last reply Reply Quote 0
              • P Offline
                powellbound API developers
                last edited by

                That worked and got me way ahead of where I thought I'd be. Thanks so much!!

                Question though, I am having trouble with other Leaflet methods and the console is telling me the requested method does not exist but I am clearly following the code per the Leaflet docs. Is there something limiting my access to certain things because I am not using the paid API? As I get further along, I will be getting the paid version.

                The specific code I am struggling with is:

                let mnw = map.getNorthWest();

                In fact, most of the map locations not map.getCenter() are not working.

                Thanks again.

                rittelsR 1 Reply Last reply Reply Quote 0
                • rittelsR Offline
                  rittels Code contributor @powellbound | Premium
                  last edited by

                  @powellbound

                  let mnw = map.getBounds().getNorthWest();

                  https://leafletjs.com/reference-1.4.0.html#latlngbounds

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    powellbound API developers
                    last edited by

                    Ahhh. I am using leaflet 0.7.7, should I be using 1.4??

                    rittelsR 1 Reply Last reply Reply Quote 0
                    • siimS Offline
                      siim
                      last edited by

                      Windy API is Leaflet 0.7.7 at the moment.

                      Near future it will be updated to 1.4

                      Windy.com main site was updated to 1.4 few weeks ago.

                      1 Reply Last reply Reply Quote 0
                      • rittelsR Offline
                        rittels Code contributor @powellbound | Premium
                        last edited by

                        @powellbound
                        Sorry about the confusion. API still 0.7.7, plugins 14.
                        Wanted to show getNorthWest() is method of LatLngBounds, not map.

                        1 Reply Last reply Reply Quote 0
                        • P Offline
                          powellbound API developers
                          last edited by

                          No worries, you have been a huge help. I was just unsure about the Leaflet version to use. I am looking forward to api 19!

                          Thanks again!!

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Windy Community  |  Powered by excellent NodeBB
                          Terms of Use     Privacy Policy     Windy.com