Skip to content
Discussion options

You must be logged in to vote

For this endpoint I would use JSON/GeoJSON if you need the icon URL. The Observation schema has an icon URI field, while the legacy XML response only gives icon_url_base and icon_url_name.

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:

https://api.weather.gov/icons/land/{day-or-night}/{condition-code}?size=medium

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 observation icon field and the ico…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MartinThorsen
Comment options

Answer selected by MartinThorsen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants