Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7978417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:29:18+00:00 2026-06-04T09:29:18+00:00

I want to implement weather information which will show me results that depends on

  • 0

I want to implement weather information which will show me results that depends on my longitude and latitude.

My app is getting coordinates from GPS so getting them is not a problem. Only thing is, I want to show some weather information for the city that is nearest me and that it has weather info.

Can you give me some ideas and solutions.

What do you think about google weather API?

How to make this to search for the nearest and how to give to this code lat and long.

public static void GoogleWeather(string location)  
    {  
        HttpWebRequest GoogleRequest;  
        HttpWebResponse GoogleResponse = null;  
        XmlDocument GoogleXMLdoc = null;  
        try  
        {  
            GoogleRequest = (HttpWebRequest)WebRequest.Create("http://www.google.com/ig/api?weather=" + string.Format(location));  
            GoogleResponse = (HttpWebResponse)GoogleRequest.GetResponse();  
            GoogleXMLdoc = new XmlDocument();  
            GoogleXMLdoc.Load(GoogleResponse.GetResponseStream());  

            XmlNode root = GoogleXMLdoc.DocumentElement;  

            XmlNodeList nodeList1 = root.SelectNodes("weather/forecast_information");  
            HttpContext.Current.Response.Write("<b>City : " + nodeList1.Item(0).SelectSingleNode("city").Attributes["data"].InnerText + "</b>");  

            XmlNodeList nodeList = root.SelectNodes("weather/current_conditions");  
            HttpContext.Current.Response.Write(" 
");  
            HttpContext.Current.Response.Write(" 
<table class="bordered" cellpadding="5"> 
<tbody><tr><td><b><big><nobr>" + nodeList.Item(0).SelectSingleNode("temp_c").Attributes["data"].InnerText + " °C | " + nodeList.Item(0).SelectSingleNode("temp_f").Attributes["data"].InnerText + " °F</nobr></big></b>");  
            HttpContext.Current.Response.Write("<b>Current:</b> " + nodeList.Item(0).SelectSingleNode("condition").Attributes["data"].InnerText + "");  
            HttpContext.Current.Response.Write("" + nodeList.Item(0).SelectSingleNode("wind_condition").Attributes["data"].InnerText + "");  
            HttpContext.Current.Response.Write(nodeList.Item(0).SelectSingleNode("humidity").Attributes["data"].InnerText);  
            nodeList = root.SelectNodes("descendant::weather/forecast_conditions");  
            foreach (XmlNode nod in nodeList)  
            {  
                HttpContext.Current.Response.Write("</td> 
<td align="center">" + nod.SelectSingleNode("day_of_week").Attributes["data"].InnerText+ "");  
                HttpContext.Current.Response.Write("<img src="http://www.google.com" + nod.SelectSingleNode("icon").Attributes["data"].InnerText + "" alt="" + nod.SelectSingleNode("condition").Attributes["data"].InnerText + "">");  
                HttpContext.Current.Response.Write(nod.SelectSingleNode("low").Attributes["data"].InnerText + "°F | ");  
                HttpContext.Current.Response.Write(nod.SelectSingleNode("high").Attributes["data"].InnerText + "°F");  
            }  
            HttpContext.Current.Response.Write("</td> 
</tr> 
</tbody></table> 

");  
        }  
        catch (System.Exception ex)  
        {  
            HttpContext.Current.Response.Write(ex.Message);  
        }  
        finally  
        {  
            GoogleResponse.Close();  
        }  
    }  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:29:20+00:00Added an answer on June 4, 2026 at 9:29 am

    I actually had a similar issue a while back.

    I decided to go with Wunderground as I had too many issues with Google Weather. *Edit, I added a working google example below the wunderground one. The google api requires a city name or a zip code it seems.

    Here is my example, pardon my sloppy code, typing this from memory.

    public static DayOfWeek Wunderground(string latlong)
        {
            //Insert your API key in the below URL
            //string latlong = "37.8,-122.4";
            string url = "http://api.wunderground.com/api/*insertyourapikeyhere*/geolookup/conditions/forecast/q/"+latlong+".xml";
    
            HttpWebRequest web = (HttpWebRequest)WebRequest.Create(url);
            web.UseDefaultCredentials = true;
            web.PreAuthenticate = true;
            web.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19";
            web.GetResponse();
            //Get Dopplar Image
            var dop = "http://api.wunderground.com/api/7dca468f5dd2ff1b/animatedradar/q/TX/Houston.gif?newmaps=1&timelabel=1&width=640&height=480&timelabel.y=10&num=15&delay=50";
            WebClient wc = new WebClient();
            wc.DownloadFile(dop, "dop.gif");
    
            //Prepare my custom property
            var d = new WeatherLib.DayOfWeek();
            d.Current = new WDay();
            WDay forecast = new WDay();
            var conditions = d;
            var xmlConditions = new XmlDocument();
    
            //download the api xml
            XDocument api = XDocument.Load(url);
            api.Save("api.xml");
            xmlConditions.Load(string.Format(@"api.xml"));
    
            XmlNodeList list = xmlConditions.SelectNodes("/response/current_observation");
            WDay current = d.Current;
    
            //Parse out the XML data
            foreach (XmlNode node in list)
            {
                current.WeatherText = node.SelectSingleNode("weather").InnerText;
                current.TempCurrentF = node.SelectSingleNode("temp_f").InnerText;
                current.TempCurrentC = node.SelectSingleNode("temp_c").InnerText;
                current.Humidity = node.SelectSingleNode("relative_humidity").InnerText;
                current.WindDirection = node.SelectSingleNode("wind_dir").InnerText;
                current.WindSpeedM = node.SelectSingleNode("wind_mph").InnerText;
                current.WindSpeedK = node.SelectSingleNode("wind_kph").InnerText;
                current.Barometer = node.SelectSingleNode("pressure_mb").InnerText;
                current.HeatIndexF = node.SelectSingleNode("heat_index_f").InnerText;
                current.HeatIndexC = node.SelectSingleNode("heat_index_c").InnerText;
                current.WindChill = node.SelectSingleNode("windchill_string").InnerText;
                current.UVIndex = node.SelectSingleNode("UV").InnerText;
                current.RainAmount = node.SelectSingleNode("precip_today_in").InnerText;
                current.Visibility = node.SelectSingleNode("visibility_mi").InnerText;
                current.DewPoint = node.SelectSingleNode("dewpoint_f").InnerText;
    
    
            }return d;
        }
    

    Google example

    public static DayOfWeek Google(string zip)
        {
            string urlstring = "http://www.google.com/ig/api?weather="+zip;
            var d = new WeatherLib.DayOfWeek();
            d.Monday = new WDay();
            d.Tuesday = new WDay();
            d.Wednesday = new WDay();
            d.Thursday = new WDay();
            d.Friday = new WDay();
            d.Saturday = new WDay();
            d.Sunday = new WDay();
            d.Current = new WDay();
    
            WDay forecast = new WDay();
            var conditions = d;
            var xmlConditions = new XmlDocument();
            XDocument api = XDocument.Load(urlstring);
            api.Save("api.xml");
            xmlConditions.Load(string.Format(@"api.xml"));
            if (xmlConditions.SelectSingleNode("xml_api_reply/weather/problem_cause") != null)
            {
                conditions = null;
            }
            else
            {
    
                var singleNode = xmlConditions.SelectSingleNode("xml_api_reply/weather/current_conditions/condition");
                if (singleNode != null)
                    if (singleNode.Attributes != null)
                        conditions.Current.WeatherText =
                            singleNode.Attributes[
                                "data"].InnerText;
                var node = xmlConditions.SelectSingleNode("xml_api_reply/weather/current_conditions/temp_c");
                if (node != null)
                    if (node.Attributes != null)
                        conditions.Current.TempCurrentC =
                            node.Attributes["data"]
                                .InnerText;
                var selectSingleNode1 = xmlConditions.SelectSingleNode("xml_api_reply/weather/current_conditions/temp_f");
                if (selectSingleNode1 != null)
                    if (selectSingleNode1.Attributes != null)
                        conditions.Current.TempCurrentF =
                            selectSingleNode1.Attributes["data"]
                                .InnerText;
                var singleNode1 = xmlConditions.SelectSingleNode("xml_api_reply/weather/current_conditions/humidity");
                if (singleNode1 != null)
                    if (singleNode1.Attributes != null)
                        conditions.Current.Humidity =
                            singleNode1.Attributes[
                                "data"].InnerText;
                var xmlNode1 = xmlConditions.SelectSingleNode("xml_api_reply/weather/current_conditions/wind_condition");
                if (xmlNode1 != null)
                    if (xmlNode1.Attributes != null)
                        conditions.Current.WindSpeedM =
                            xmlNode1.Attributes
                                ["data"].InnerText;
    
                if (xmlConditions.SelectSingleNode("xml_api_reply/weather/problem_cause") != null)
                {
                    conditions = null;
                }
                else
                {
                    XmlNodeList list = xmlConditions.SelectNodes("/xml_api_reply/weather");
                    foreach(XmlNode node1 in list)
                    {
                        XmlNodeList days = node1.SelectNodes("forecast_conditions");
                        foreach (XmlNode doo in days)
                        {
                            string dow = doo.SelectSingleNode("day_of_week").Attributes["data"].InnerText;
                            switch (dow)
                            {
                                case "Mon":
                                    forecast = d.Monday;
                                    break;
                                case "Tue":
                                    forecast = d.Tuesday;
                                    break;
                                case "Wed":
                                    forecast = d.Wednesday;
                                    break;
                                case "Thu":
                                    forecast = d.Thursday;
                                    break;
                                case "Fri":
                                    forecast = d.Friday;
                                    break;
                                case "Sat":
                                    forecast = d.Saturday;
                                    break;
                                case "Sun":
                                    forecast = d.Sunday;
                                    break;
                            }
                            forecast.WeatherText = doo.SelectSingleNode("condition").Attributes["data"].InnerText;
                            forecast.TempHiF = doo.SelectSingleNode("high").Attributes["data"].InnerText;                         
                        }
                    }       
                }
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement an application which will work as a parser. User will
Microsoft has announce that WindowsLiveID become a OpenID provider . I want implement it
I wrote small service class and I want implement something like that : service
everyone! My english is poor and sorry fot that. I want implement a function
I need add paging to panel, which populated with dynamically-created controls. I want implement
I want to implement a simple command line based image editor. The program will
I am new to Graph concept in android. In my app i want implement
I want to implement support of the XMLRPC protocol for my server that is
I want to make an app for android that updates via the internet so
i want implement geolocation notification like the app reminders. this is what i have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.