How to obtain the icon from a latest observation #862
-
|
I am a newbie, so I apologize in advance, but I haven't been able to find the information. I would like to display the icon associated with data returned from a call to In the data, I get back see How do I get the image that's associated with that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
For this endpoint I would use JSON/GeoJSON if you need the icon URL. The Observation schema has an For example: curl -H 'accept: application/geo+json' \
'https://api.weather.gov/stations/KRZN/observations/latest' |
jq -r '.properties.icon'That returns a full URL shaped like: The XML values alone are not enough to form that URL, because the current icon route also needs the condition code segment ( |
Beta Was this translation helpful? Give feedback.
For this endpoint I would use JSON/GeoJSON if you need the icon URL. The Observation schema has an
iconURI field, while the legacy XML response only givesicon_url_baseandicon_url_name.For example:
That returns a full URL shaped like:
The XML values alone are not enough to form that URL, because the current icon route also needs the condition code segment (
bkn,skc, etc.):/icons/{set}/{timeOfDay}/{first}. One caveat: the API schema marks the observationiconfield and the ico…