Windy Community

    • Register
    • Login
    • Search
    • Unread
    • Categories
    • Groups
    • Go to windy.com

    Solved How to create marker on URL

    UI Glitches
    on monday url picker marker
    5
    19
    2628
    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.
    • rittels
      rittels Code contributor | Premium last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • rittels
        rittels Code contributor @GeGaX | Premium last edited by rittels

        @GeGaX

        JS function for you:

        function createCoordCode(coords){
            let ar=[];
            for (let i=98; i < 123; i++) ar.push(String.fromCharCode(i));
            for (let i=65; i < 91; i++) ar.push(String.fromCharCode(i));
            for (let i=0; i < 9; i++) ar.push(i);
        
            let lat=Math.round(100*(coords.lat+90));
            let lon=Math.round(100*(coords.lon+180));
        
            lt1=Math.floor(lat/3600);
            lt2=Math.floor((lat-lt1*3600)/60);
            lt3=lat-lt1*3600-lt2*60;
        
            ln1=Math.floor(lon/3600);
            ln2=Math.floor((lon-ln1*3600)/60);
            ln3=lon-ln1*3600-ln2*60;
        
            return "m:"+ar[lt1]+ar[lt2]+ar[lt3]+"a"+ar[ln1]+ar[ln2]+ar[ln3];
        }
        
        console.log(createCoordCode({lat:-29,lon:100}));
        
        G 2 Replies Last reply Reply Quote 0
        • G
          GeGaX @rittels last edited by

          @rittels Thanks, I test it and tell you πŸ˜‰

          1 Reply Last reply Reply Quote 0
          • G
            GeGaX @rittels last edited by

            @rittels
            alt text
            I have a shift of 7 second North and 11 second West between the real position and Windy position.
            What should I correct in your code to obtain an identical position?
            Thanks again for the code, it's cool πŸ˜‰

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

              @GeGaX

              That happens, because the max resolution of the alphanum code is 0.01deg, thus 36 seconds (about 1km).

              made code a bit shorter:

              function createCoordCode(coords){
                  let ar=[];
                  for (let i=98;i < 123;i++)ar.push(String.fromCharCode(i));
                  for (let i=65;i < 91;i++)ar.push(String.fromCharCode(i));
                  for (let i=0;i < 9;i++)ar.push(i);
              
                  let lat=Math.round(100*(coords.lat+90));
                  let lon=Math.round(100*(coords.lon+180));
              
                  return "m:"
                          +ar[Math.floor(lat/3600)]
                          +ar[Math.floor((lat%3600)/60)]
                          +ar[lat%60]+"a"
                          +ar[Math.floor(lon/3600)]
                          +ar[Math.floor((lon%3600)/60)]
                          +ar[lon%60];
              }
              console.log(createCoordCode({lat:38,lon:-30}));
              
              G 1 Reply Last reply Reply Quote 1
              • G
                GeGaX @rittels last edited by

                @rittels
                ok understood, thanks for everything πŸ˜‰

                G 1 Reply Last reply Reply Quote 0
                • G
                  GeGaX @GeGaX last edited by GeGaX

                  @rittels
                  In place and functional, thanks πŸ˜‰

                  1 Reply Last reply Reply Quote 1
                  • T
                    TomSlavkovsky API developers last edited by

                    Hi, guys we will give the option to share the picker in URL. It will be possible very soon by adding d:picker` into the URL.

                    G 1 Reply Last reply Reply Quote 4
                    • G
                      GeGaX @TomSlavkovsky last edited by

                      @TomSlavkovsky
                      Hi TomSlavkovsky,
                      will you share the info here when it's possible?
                      Thanks πŸ˜‰

                      1 Reply Last reply Reply Quote 1
                      • T
                        TomSlavkovsky API developers last edited by

                        @GeGaX @rittels It's now possible to open Windy with picker.

                        Also recommend to check following topic: https://community.windy.com/topic/77/windy-com-url-parameters

                        G rittels 2 Replies Last reply Reply Quote 3
                        • G
                          GeGaX @TomSlavkovsky last edited by

                          @TomSlavkovsky
                          Thanks for this improvement, it works very well ;)
                          The GPS coordinates displayed, by the picker, are translated exactly as those sent despite the truncated display in the address bar, it's perfect !

                          @rittels
                          Thanks again for the JS code which has helped me well until here.
                          (And in addition I discovered the GeoHash system ;p)

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

                            @TomSlavkovsky

                            Cool. Thanks!! Works well.

                            Can we mount plugins yet? I see we can open an airport from path.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Windyty, S.E. - all rights reserved. Powered by excellent NodeBB
                            NodeBB & contributors, OSM & contributors, HERE maps
                            Terms and Conditions     Privacy Policy