MeteoGroup / weather-api

The repo has been migrated to Bitbucket https://bitbucket.org/dtnse/weather-api/src/ and archived
https://api.weather.mg
Apache License 2.0
30 stars 9 forks source link

Weather Icons #2

Open JefNewTech opened 8 years ago

JefNewTech commented 8 years ago

Hello, is it possible to add the type of weather as an icon? To display as an icon in your applications? consistent with this https://erikflowers.github.io/weather-icons/ thank you

almottier commented 6 years ago

+1 would be very nice to map icons to weatherCode

treewhisperer commented 5 years ago

Could you please comment on this, is this on the roadmap? Or could you tell us if there's a workaround to link any of the existing params to different weather icons?

albertvp commented 4 years ago

I made this, just a guide, working in TypeScript... if it helps, just transform XML to JSON and replace emojis with icon id's from https://github.com/erikflowers/weather-icons/blob/master/values/weathericons.xml

// Index of the weather type in the area.
export enum EWeatherCode {
  clear = 'Clear',
  partlyCloud = 'Partly cloudy',
  cloudy = 'Cloudy',
  fog = 'Fog',
  drizzle = 'Drizzle',
  rain = 'Rain',
  freezingRain = 'Freezing rain',
  snow = 'Snow',
  rainShower = 'Rain shower',
  snowShower = 'Snow shower',
  hail = 'Hail',
  thunder = 'Thunder',
}

export const WeatherCodes = {
  clear: ['☀ī¸', '🌙'],
  partlyCloud: ['🌤ī¸', '⛅'],
  cloudy: ['⛅', '☁ī¸'],
  fog: ['đŸŒĢī¸', '🌁'],
  drizzle: ['đŸŒĻī¸', '🌈'],
  rain: ['🌧ī¸', 'đŸŒĻī¸'],
  freezingRain: ['❄ī¸ī¸', 'ī¸đŸŒ¨ī¸'],
  snow: ['⛈ī¸', '❄ī¸'],
  rainShower: ['ī¸đŸŒ¨ī¸', '⛆'],
  snowShower: ['☃ī¸', '❄ī¸ī¸'],
  hail: ['đŸŒĒī¸', 'đŸ—ŋ'],
  thunder: ['⛈ī¸', '🌩ī¸'],
}

export const WeatherKeys = {
  '0': WeatherCodes.clear,
  '1': WeatherCodes.partlyCloud,
  '2': WeatherCodes.cloudy,
  '3': WeatherCodes.fog,
  '4': WeatherCodes.drizzle,
  '5': WeatherCodes.rain,
  '6': WeatherCodes.freezingRain,
  '7': WeatherCodes.snow,
  '8': WeatherCodes.rainShower,
  '9': WeatherCodes.snowShower,
  '10': WeatherCodes.hail,
  '11': WeatherCodes.thunder,
}