This project is read-only.

Animaonline Weather API - Code Samples

Getting the weather
gettingWeather.PNG
            Animaonline.WeatherAPI.WeatherData wD = new WeatherData(LanguageCode.en_US, "Phoenix , AZ");
            Console.WriteLine("Condition:{0} Temperature:{1}°F {2}°C", wD.condition, wD.temp_f, wD.temp_c);

Getting the weather for multiple cities
multipleCities.PNG
            Animaonline.WeatherAPI.WeatherData wD = new WeatherData();
            string[] Cities = new string[]
            {
                "Phoenix, AZ",
                "Redmond, WA",
                "Tokyo"
            };

            foreach (string city in Cities)
            {
                wD.GetWeather(LanguageCode.en_US, city);
                Console.WriteLine("City:{0} Condition:{1} Temperature:{2}°F {3}°C", wD.city, wD.condition, wD.temp_f, wD.temp_c);
                wD = Animaonline.WeatherAPI.WeatherAPI.GetWeather(LanguageCode.en_US, city);
            }

Generating A Google Map
GoogleMaps.PNG
            Animaonline.GeoServices.GeoCode.ApiKey = @"ABQIAAAAcfro-nUikyoPOdaGgVQXixT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQF1babbZihJSXl-do4udxcpwMAaA";
            Animaonline.WeatherAPI.WeatherData wD = new WeatherData(LanguageCode.en_US, "Drammen", false, true);

            string weatherString = string.Format("City:{0} Condition:{1} Temperature:{2}°F {3}°C", wD.city, wD.condition, wD.temp_f, wD.temp_c);

            Animaonline.Maps.GoogleMapGenerator.Map map;
            map = new Animaonline.Maps.GoogleMapGenerator.Map(wD.latitude_e6, wD.longitude_e6, weatherString, 640, 480, 11);
            map.SaveMap("c:\\map.html");

Programmed by Roman Alifanov, uses Google's Weather Feed, licensed under GNU General Public License version 2
© 2007-2009 Roman Alifanov

Last edited Jul 31, 2009 at 2:24 PM by animaonline, version 5

Comments

No comments yet.