Weather forecast

Table of Contents

Weather forecast

(Professional accounts only)

Get weather forecast for specific location defined by latitude and longitude.

URL

https://api.forecast.solar/:key/weather/:lat/:lon
  • key - personal API key for registered users
  • lat - latitude of location, -90 (south) … 90 (north)
  • lon - longitude of location, -180 (west) … 180 (east)

You can poke around with the Swagger Editor to build proper request URLs.

Result

  • datetime - Human readable date and time
  • timestamp - The UNIX time, seconds since midnight GMT on 1 Jan 1970
  • sky - A numerical value between 0 and 1 (inclusive) representing the percentage of clear sky, a value of 1 corresponds to clear sky.
  • temperature - Degrees Celsius
  • condition - Human-readable text summary
  • icon - A machine-readable text summary
  • wind_speed - Numerical value representing the wind speed in kilometers per hour
  • wind_degrees - Numerical value representing the direction that the wind is coming from in degrees, with true north at 0° and progressing clockwise. (If windSpeed is zero, then this value will not be defined.)
  • wind_direction - Short name for wind Direction

Example

Get weather forecast for midpoint of Europe (54.9° north, 25.3° east), JSON by default

curl https://api.forecast.solar/<your-API-key>/weather/54.9/25.3
{
    "result": [
        {
            "datetime": "2016-02-08 00:00:00",
            "timestamp": 1454886000,
            "sky": 0.28,
            "temperature": -1.7,
            "condition": "Mostly Cloudy",
            "icon": "partly-cloudy-night",
            "wind_speed": 25,
            "wind_degrees": 177,
            "wind_direction": "S"
        },
        {
            "datetime": "2016-02-08 00:15:00",
            "timestamp": 1454886900,
            "sky": 0.28,
            "temperature": -1.8,
            "condition": "Mostly Cloudy",
            "icon": "partly-cloudy-night",
            "wind_speed": 25,
            "wind_degrees": 177,
            "wind_direction": "S"
        },
        {
            "datetime": "2016-02-08 00:30:00",
            "timestamp": 1454887800,
            "sky": 0.28,
            "temperature": -1.9,
            "condition": "Mostly Cloudy",
            "icon": "partly-cloudy-night",
            "wind_speed": 25,
            "wind_degrees": 177,
            "wind_direction": "S"
        },
        ...
    ],
    "message": {
        "code": 0,
        "type": "success",
        "text": "Distance: 1.069 km"
    }
}

The icon attribute can be used for example with Skycons or Adam Whitcroft's Climacons