free weather api


 

I(Borislav Nikolov) got upset how people are selling free data at some ludicrous prices, so I made freeweatherapi.com using cached data from api.met.no

at the moment this is costing me 8€/y for the domain and about 10€ per month for digital ocean, I promise to run it until it costs me < 50€ per month, if you dont like that just run it locally

updating about 40_000 locations, key size is 12 bytes, value size is 80b 40_000 * (12 + 80)bytes * 24 hours * 30 days is about 2.3gb per month

since protobuf does not write the zero values, average value size is smaller, so it is about 1.5gb

data is updated every 7 hours, and the lat/lng resolution is +-50km, but quite good for predictions are up to 1 month in the future, but you can also look 1 day in the past

we are updating 42000 cities from free-world-cities-database, rounded to closest 0.5 lat/lng

and all top1000 cities from file-top-1000-cities-json

api

query api - https://freeweatherapi.com/v1/query, method POST

 { "locations" : [ { "lat" : 0, "lng" : -176, "timestamp" : 1535284800 } ] }
  • lat: latitude (x.678 gets normalized to x.5, x.123 -> x.0)
  • lng: longituede (x.678 gets normalized to x.5, x.123 -> x.0)
  • timestamp: timestamp of the hour you are interested in, x gets normalized to closest beginning of hour((x / 3600) * 3600)
curl -XPOST -s -d '{"locations":[{"lat":2,"lng":-53}]}' \ https://freeweatherapi.com/v1/query | json_pp
{ "locations" : [ { "weather" : { "dewpointTemperatureC" : 24.2, "cloudinessPercent" : 50.8, "lowCloudsPercent" : 50.8, "windSpeedMps" : 3.6, "pressureHPA" : 1013.9, "from" : 1535889600, "humidityPercent" : 76.1, "to" : 1535889600, "updatedTimestamp" : 1535436757, "windDirectionDeg" : 91.4, "temperatureC" : 28.4 }, "location" : { "timestamp" : 1535889600, "lng" : -53, "lat" : 2 } } ], "license" : "Based on data from MET Norway, License: https://api.met.no/license_data.html"
}

batch api - https://freeweatherapi.com/v1/batch, method POST

stream of all data for specific hour (one location per row)

curl -X POST -d '{"timestamp":...}' https://freeweatherapi.com/v1/batch
{"result":{"from":1535900400,..."temperatureC":41,"lat":37,"lng":38.5}}
{"result":{"from":1535900400,..."temperatureC":29.c,"lat":34.5,"lng":68}}

use it as much as you want, just make sure you credit MET Norway

if you want to contribute fork https://github.com/jackdoe/weather

    Todo
  • get more providers besides met.no
  • add dump api
Icon made by Good Ware from www.flaticon.com is licensed by CC 3.0 BY