Navigation

    Windy Community

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

    How to update zoom-level at runtime?

    General Discussion
    2
    5
    278
    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.
    • T
      TheStigh last edited by

      Hi all,

      Writing a javascript for MagicMirror, and it is mostly finished.
      Though I've struck a problem; how to change Zoom-level at runtime?

      Any help will be highly appreciated :)

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

        W.map.setView( center, zoom?, options? )
        W.map.setZoom( zoom, options? )
        W.map.zoomIn( delta?, options? )
        W.map.zoomOut( delta?, options? )

        https://leafletjs.com/reference-0.7.7.html#map-set-methods

        Windy (W.map) uses Leaflet 0.7.7

        T 1 Reply Last reply Reply Quote 0
        • T
          TheStigh @siim last edited by TheStigh

          @siim said in How to update zoom-level at runtime?:

          W.map.setView( center, zoom?, options? )
          W.map.setZoom( zoom, options? )
          W.map.zoomIn( delta?, options? )
          W.map.zoomOut( delta?, options? )

          https://leafletjs.com/reference-0.7.7.html#map-set-methods

          Windy (W.map) uses Leaflet 0.7.7

          Hi @siim ,

          I'm still a bit noob in development and have used the [store] and windyInit:

          const options = {
                  key: 'xxx',
                  zoom: 5,
                  lat: xx.xxx,
                  lon: yy.yyy
                  },
          
          windyInit( options, windyAPI => {
                  const { store } = windyAPI
                  store.set('overlay', wind )
                  },
                  });
          

          Can I somehow change zoom level using store.set ?

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

            @TheStigh said in How to update zoom-level at runtime?:

                const { store, map } = windyAPI
                map.setZoom(10)
            T 1 Reply Last reply Reply Quote 0
            • T
              TheStigh @siim last edited by

              @siim

              Thanks, that worked :)
              Can I change overlay (like from 'wind' to 'rain') using [map.] method, rather than using

              store.set('overlay', wind )
              

              ?

              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