leaflet-weathericonslayer

Current weather icons layer for Leaflet, based on OpenWeatherMap API


Keywords
openweathermap, leaflet, weather
License
CERN-OHL-P-2.0
Install
bower install leaflet-weathericonslayer

Documentation

Leaflet.WeatherIconsLayer

Current weather icons layer for Leaflet, based on OpenWeatherMap API. Partial rework of outdated sample script from OpenWeatherMap site.

As an OpenWeatherMap derivative work, licenced with Creative Commons BY-SA 2.0. OpenWeatherMap Terms of service apply.

See live example.

Installation

  • NPM: npm install leaflet-weathericonslayer
  • Bower: bower install leaflet-weathericonslayer

Usage

map.addLayer(new L.WeatherIconsLayer());

Also, several options available. Here are the defaults shown:

map.addLayer(new L.WeatherIconsLayer({
    apiKey: undefined,                  // OpenWeatherMap API key
    host: 'http://openweathermap.org/', // API host
    i18n: {...},                        // object with translation strings, see code
    units: 'metric',                    // or 'imperial'; temperature scale
    temperatureDigits: 0,               // how many decimal digits in temperature
    maxAgeSeconds: 24*60*60,            // 24h; how long the weather data is considered worth showing
}));