Weather Data from OpenWeatherMAP

Christie Widget Designer Version 6 - Q&A

Moderator: Moderator Group

Forum rules
When asking make sure to include the operating system and the revision of Widget Designer you are using.

Weather Data from OpenWeatherMAP

Postby Daniel Kaminski » Fri Dec 23, 2022 7:14 pm

If you need to get get current weather Data from openweathermap.org for free

You only need to sign up for a free api key.
https://openweathermap.org/


Code: Select all
var lat = "51.5942009"
var lon = "7.1368071"


// Your API-KEY
var appid = "your API Key here"
// Units: metric, imperial
var units = "metric"
// Output Language : de, en, fr ...
var lang = "de"
var url = "https://api.openweathermap.org/data/2.5/weather?"

var msg = url
msg += "lat=" + lat
msg += "&lon=" + lon
msg += "&units=" + units
msg += "&lang=" + lang
msg += "&appid=" + appid

var responsestr = ""
HTTPRequestToVar(msg,"responsestr","GET","application/json")

var weather = responsestr.ToJson
TextBox1.Clear
TextBox1.Append(weather.ToPrettyString)

var temp = weather.Get("main.temp")
var w_lst = weather.GetList("weather")
var j_desc = w_lst[0].ToJson
var desc = j_desc.GetString("description")

Label2.text = "Das Wetter in " + w.GetString("name") + " ist " + desc + " bei " + temp + "°C"
You do not have the required permissions to view the files attached to this post.
--
Daniel Kaminski
Pandoras Box Expert
User avatar
Daniel Kaminski
 
Posts: 1050
Joined: Tue Jul 22, 2008 10:55 am
Location: Herten, Germany

Return to Widget Designer V6

Who is online

Users browsing this forum: No registered users and 4 guests