OpenWeatherMap

 

I'm currently working on an IoT and Azure presentation building a Xamarin.Forms app to gather sensors data from mobile devices (Raspberry Pi will come next).  Mobile device don't usually have a built-in temperature sensor but would it be possible to get the local temperature using the location and an external service for free?  Sure thing!  After a quick search on the Interwebs I found OpenWeatherMap that have a Web API and a free pricing tier.

By using the latitude and longitude, you get a nice JSON result easily consumable in .NET or JavaScript.

http://api.openweathermap.org/data/2.5/weather?lat=45.4972292&lon=-73.5666525&units=metric

{"coord":{"lon":139,"lat":35},
"sys":{"country":"JP","sunrise":1369769524,"sunset":1369821049},
"weather":[{"id":804,"main":"clouds","description":"overcast clouds","icon":"04n"}],
"main":{"temp":289.5,"humidity":89,"pressure":1013,"temp_min":287.04,"temp_max":292.04},
"wind":{"speed":7.31,"deg":187.002},
"rain":{"3h":0},
"clouds":{"all":92},
"dt":1369824698,
"id":1851632,
"name":"Shuzenji",
"cod":200}

 

blog comments powered by Disqus

Page List

Month List