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.
- NPM:
npm install leaflet-weathericonslayer - Bower:
bower install leaflet-weathericonslayer
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
}));