{"id":218,"date":"2014-06-16T19:34:33","date_gmt":"2014-06-16T18:34:33","guid":{"rendered":"http:\/\/jonika.nu\/JonasBlogg\/?page_id=218"},"modified":"2015-05-21T10:00:07","modified_gmt":"2015-05-21T09:00:07","slug":"weather-api","status":"publish","type":"page","link":"https:\/\/jonika.nu\/JonasBlogg\/hobbyprojects\/weather-api","title":{"rendered":"Weather API"},"content":{"rendered":"<p><span style=\"color: #373737;\">My most recent project. A .NET wrapper\/library for SMHIs free weather services, PMP. Written in C# and .NET 4.<\/span><\/p>\n<p><span style=\"color: #373737;\">The background is that I needed some kind of free weather data for a project. I looked att a few swedish and norwegian services and ended up with a service from SMHI. With this library it\u2019s super-easy to utilize weather data. No need to parse JSON and make HTTP-requests\u00a0by your self.<\/span><\/p>\n<p><strong>New version, 0.2 &#8211; 2014-06-18<br \/>\n<\/strong>Changes in this release:<\/p>\n<ul>\n<li>Added method &lt;GetForecast(DateTime) to support fetching data for a certain time. Return null if no data available for time.<\/li>\n<li>Renamed class &lt;SMHI&gt; to &lt;Weather&gt; to make it a bit more\u00a0generic<\/li>\n<li>Renamed class &lt;TimeSeriesData&gt; to &lt;TimeSeries&gt;<\/li>\n<\/ul>\n<p>Sample code to access weather data:<\/p>\n<pre class=\"lang:c# decode:true\">\/\/Position to fetch weather for\r\nPosition myPosition = new Position() { Latitude = 59.38m, Longitude = 13.49m };\r\n\r\n\/\/Create a Weather-object for that position\r\nWeather weather = Weather.Create(myPosition); \r\n\r\n\/\/Get forecast for the closest hour\r\nTimeSeries myWeather = weather.GetCurrentForecast();\r\n\r\n\/\/Get some values\r\ndecimal currentTemperature = myWeather.Temperature;\r\nint currentWindDirection = myWeather.WindDirection;\r\ndecimal currentWindVelocity = myWeather.WindVelocity;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>More documentation is on the way!<\/strong><\/p>\n<p>Read more about using SMHIs data here:\u00a0<a href=\"http:\/\/www.smhi.se\/klimatdata\/Oppna-data\/Meteorologiska-data\/api-for-vaderprognosdata-1.34233\">http:\/\/www.smhi.se\/klimatdata\/Oppna-data\/Meteorologiska-data\/api-for-vaderprognosdata-1.34233<\/a><\/p>\n<p><strong>Download<\/strong><\/p>\n<div class='w3eden'><!-- WPDM Link Template: Default Template -->\n\n<div class=\"link-template-default card mb-2\">\n    <div class=\"card-body\">\n        <div class=\"media\">\n            <div class=\"mr-3 img-48\"><img decoding=\"async\" class=\"wpdm_icon\" alt=\"Icon\" src=\"https:\/\/jonika.nu\/JonasBlogg\/wp-content\/plugins\/download-manager\/assets\/file-type-icons\/zip.svg\" \/><\/div>\n            <div class=\"media-body\">\n                <h3 class=\"package-title\"><a href='https:\/\/jonika.nu\/JonasBlogg\/download\/weatherapi-0-2'>WeatherAPI 0.2<\/a><\/h3>\n                <div class=\"text-muted text-small\"><i class=\"fas fa-copy\"><\/i> 1 file(s) <i class=\"fas fa-hdd ml-3\"><\/i> 836.12 KB<\/div>\n            <\/div>\n            <div class=\"ml-3\">\n                <a class='wpdm-download-link download-on-click btn btn-primary ' rel='nofollow' href='#' data-downloadurl=\"https:\/\/jonika.nu\/JonasBlogg\/download\/weatherapi-0-2?wpdmdl=377&refresh=6a17460ad66281779910154\">WeatherAPI 0.2<\/a>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<a href=\"https:\/\/twitter.com\/jonlin76\" class=\"twitter-follow-button\" data-show-count=\"false\" data-size=\"small\">Follow jonlin76<\/a>\n<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=\/^http:\/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+':\/\/platform.twitter.com\/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');<\/script>","protected":false},"excerpt":{"rendered":"<p>My most recent project. A .NET wrapper\/library for SMHIs free weather services, PMP. Written in C# and .NET 4. The background is that I needed some kind of free weather data for a project. I looked att a few swedish and norwegian services and ended up with a service from SMHI. With this library it\u2019s &hellip; <a href=\"https:\/\/jonika.nu\/JonasBlogg\/hobbyprojects\/weather-api\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Weather API<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":216,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/jonika.nu\/JonasBlogg\/wp-json\/wp\/v2\/pages\/218"}],"collection":[{"href":"https:\/\/jonika.nu\/JonasBlogg\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/jonika.nu\/JonasBlogg\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/jonika.nu\/JonasBlogg\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jonika.nu\/JonasBlogg\/wp-json\/wp\/v2\/comments?post=218"}],"version-history":[{"count":16,"href":"https:\/\/jonika.nu\/JonasBlogg\/wp-json\/wp\/v2\/pages\/218\/revisions"}],"predecessor-version":[{"id":380,"href":"https:\/\/jonika.nu\/JonasBlogg\/wp-json\/wp\/v2\/pages\/218\/revisions\/380"}],"up":[{"embeddable":true,"href":"https:\/\/jonika.nu\/JonasBlogg\/wp-json\/wp\/v2\/pages\/216"}],"wp:attachment":[{"href":"https:\/\/jonika.nu\/JonasBlogg\/wp-json\/wp\/v2\/media?parent=218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}