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

    how to change base map ?

    Scheduled Pinned Locked Moved Windy API v4
    9 Posts 2 Posters 5.0k 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.
    • S Offline
      shinnobi
      last edited by

      I use this code in leaflet to change base map . But when i am using windy api v4 it can't change base map

      L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', {
      attribution: 'Trung tâm thông tin & dữ liệu KTTV',
      maxZoom: 16
      }).addTo(map);

      How to do it with windy api v4

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

        L.tileLayer(
          "https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",
          {
            attribution: "Trung tâm thông tin & dữ liệu KTTV",
            minZoom: 12,
            maxZoom: 18
          }
        ).addTo(W.map);
        W.map.options.maxZoom = 18;
        
        1 Reply Last reply Reply Quote 0
        • S Offline
          shinnobi
          last edited by

          windyInit( options, windyAPI => {
          // windyAPI is ready, and contain 'map', 'store',
          // 'picker' and other usefull stuff

              const { map } = windyAPI
              // .map is instance of Leaflet map
              L.tileLayer(
              "https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",
              {
                   attribution: "Trung tâm thông tin & dữ liệu KTTV",
                      minZoom: 12,
                  maxZoom: 18
              }
              ).addTo(W.map);
              W.map.options.maxZoom = 18;
          

          i add this but it seem not working please help me

          1 Reply Last reply Reply Quote 0
          • S Offline
            shinnobi
            last edited by

            windyInit( options, windyAPI => {
                // windyAPI is ready, and contain 'map', 'store',
                // 'picker' and other usefull stuff
            
                const { map } = windyAPI
                // .map is instance of Leaflet map
                L.tileLayer(
                "https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",
                {
                     attribution: "Trung tâm thông tin & dữ liệu KTTV",
                        minZoom: 12,
                    maxZoom: 18
                }
                ).addTo(W.map);
                W.map.options.maxZoom = 18;
            

            p/s update code
            i add it but it seems not working

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

              const { map } = windyAPI
              // .map is instance of Leaflet map
              L.tileLayer(
              "https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",
              {
                  attribution: "Trung tâm thông tin & dữ liệu KTTV",
                  minZoom: 12,
                  maxZoom: 18
              }
              ).addTo(map);
              map.options.maxZoom = 18;
              

              zoom in and works fine

              1 Reply Last reply Reply Quote 0
              • S Offline
                shinnobi
                last edited by

                https://codepen.io/siim/pen/JBBepy

                i found this. but when i zoom it doesn't change base map

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

                  @shinnobi

                  Check that example again.

                  Your tile choice is not very good for windy.
                  Tiles must be transparent when showing with wind layer.
                  Only when max zoomed in you can use tiles with background.

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

                    With google basemap:
                    https://codepen.io/siim/pen/xQYvNd

                    1 Reply Last reply Reply Quote 1
                    • S Offline
                      shinnobi
                      last edited by

                      thanks you very much :D

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