Many weather data applications such as weather widgets, weather analytics tools and information displays find it useful to communicate the current weather conditions. These conditions include current temperature, wind speed and direction, recent precipitation and more.
Looking up the current weather conditions for one or more locations is easy in the Visual Crossing Weather API.
Weather api request to retrieve the current conditions
The Weather API includes the current conditions in all weather forecast requests. We simply need to make a weather forecast request to retrieve the current conditions. Note that the current conditions are only returned for requests that ask for the results in JSON format.
From the Weather API Documentation, we can see a weather forecast looks like:
Note that to run requests yourself, you will need to sign up for a free API key.
To vary the location requested, simply change the address in the ‘locations’ parameter. In this case we are requesting the current conditions for London,UK. The location can be specified as a full address, a partial address such as city and country or zip code. Also, you can specify the location as latitude,longitude combination.
Current conditions weather api request results
The current conditions are returned as part of the weather forecast result. In the above request, we requested the output in ‘single’ location mode which simplifies the output:
Accessing the current conditions is therefore quite simple. The JSON includes a the ‘location’ property which in turn includes the ‘currentConditions’ property. The current conditions then include properties for the current weather. In addition, the conditions includes the time of the report and astronomical information such as a sunrise and sunset for the current date.
See the full documentation for for more information on the output JSON format.
How we find the current conditions
We use our historical weather database to look up the recent data. Where possible, we use our sub-hourly data. This ensures that the current conditions reflect the absolute latest information. The sub-hourly data also includes 10000s weather stations including personal weather stations. This ensures that the current conditions are as close as possible to the current time and requested location.
Depending on the requested location, the current conditions will typically be accurate to between five and 60 minutes. For more remote locations, this range may be longer if there are no local weather stations.