-
I'm using bootstrap icons in a project of mine, and I would like to show an icon representing the current forecast (sunny, cloudy, raining, etc.), how would I get an ID of some sorts representing the current weather? Ideally I'd like to use the WMO weather interpretation codes, as that would easily integrate into the existing codebase, but this is not necessary if extra logic would be required to interpret the weather code. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
By "current weather," do you mean the last observation at a nearby observation station, or the forecast for the current/next hour? And/or: What API call are you using that you're trying to determine an icon for? |
Beta Was this translation helpful? Give feedback.
-
The official answer is the API doesn't support a simple key/code yet, but unofficially the URL property in the forecast and forecast hourly endpoints does the same thing, so you could steal from that (reference /icons for possible values). I develop radar.weather.gov and have been asking for an official API key/code for some time, and have hope circumstances will provide that somewhat soon. The wmo link is interesting...I will float that to the group that sets priorities for the API. |
Beta Was this translation helpful? Give feedback.
-
Is the shortDescription taking from an existing finite set? I'm hoping to map it to the icon, but that may be folly. |
Beta Was this translation helpful? Give feedback.
-
I'm happy to grab the portion of the icon url between the last slash and the first question mark, but I'm concerned that https://api.weather.gov/icons "Returns a list of icon codes and textual descriptions. Icon services in API are deprecated." according to the OpenAPI spec. I just spent a bunch of time enumerating all the possible icons used by forecast.weather.gov (MapClick) via https://www.weather.gov/forecast-icons but am trying to move to the new API to be a little more futureproof and make the government happy. Additionally the OpenAPI spec itself just lists the entire useful response body as |
Beta Was this translation helpful? Give feedback.
The official answer is the API doesn't support a simple key/code yet, but unofficially the URL property in the forecast and forecast hourly endpoints does the same thing, so you could steal from that (reference /icons for possible values). I develop radar.weather.gov and have been asking for an official API key/code for some time, and have hope circumstances will provide that somewhat soon. The wmo link is interesting...I will float that to the group that sets priorities for the API.