Windy Community

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

    how to change base map ?

    Windy API v4
    2
    9
    2269
    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
      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
      • siim
        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
          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
            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
            • siim
              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
                shinnobi last edited by

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

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

                siim 1 Reply Last reply Reply Quote 0
                • siim
                  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
                  • siim
                    siim last edited by

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

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

                      thanks you very much :D

                      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 of Use     Privacy Policy