Change units

Each of Windy's overlays has its own object in windyApi.overlays modules. Use these objects to change an overlay's metric. For example, for wind overlay, use the read only value overlays.wind.metric to get the actual value, .listMetrics() to get allowed ones, and .setMetric(metric) to set the metric to the new value.

Source code


            content="width=device-width, initial-scale=1.0, shrink-to-fit=no"
        <script src=""></script>
        <script src=""></script>
            #windy {
                width: 100%;
                height: 300px;
        <div id="windy"></div>
        <script src="script.js"></script>


const options = {
    key: 'PsLAtXpsPTZexBwUkO7Mx5I', // REPLACE WITH YOUR KEY !!!

windyInit(options, windyAPI => {
    // All the params are stored in
    const { overlays, broadcast } = windyAPI;

    const windMetric = overlays.wind.metric;
    // 'kt' .. actually selected metric for wind overlay
    // Read only value! Do not modify.

    // ['kt', 'bft', 'm/s', 'km/h', 'mph'] .. available metrics

    // Metric for wind was changed to bft

    broadcast.on('metricChanged', (overlay, newMetric) => {
        // Any changes of any metric can be observed here
        console.log(overlay, newMetric);