locked
Google weather API help RRS feed

  • Question

  • Hello! This thread originally had another question, so i just changed the name so i don't mess up the forum. Ok, so i decided to use google api weather:

    http://www.google.com/ig/api?weather=london+uk

    And i got this code

     XElement doc = XElement.Load("http://www.google.com/ig/api?weather=london+uk");
                
                string theTemp = doc.XPathSelectElement(@"weather/current_conditions/temp_f").Attribute("data").Value;
                string theHumid = doc.XPathSelectElement(@"weather/current_conditions/humidity").Attribute("data").Value;
                string theWind = doc.XPathSelectElement(@"weather/current_conditions/wind_condition").Attribute("data").Value;
    
                string resultString = String.Format("Temp:{0}f.\r\n{1}.\r\n{2}",  theTemp, theHumid, theWind);
                textBox1.Text = resultString;

    And i get:

    Temp:57f.
    Humidity: 82%.
    Wind: SW at 5 mph

    But what i need is:

    Temperature :57f.
    Humidity: 82%.
    Wind:5 mph 

    How can i do it? 



    • Edited by Neket110 Sunday, July 22, 2012 2:34 AM
    Saturday, July 21, 2012 6:13 PM

Answers

All replies

  • Most services are xml based that I am aware.  The services leave it to you to format the info in a way you see appropriate.

    --
    Mike
    Saturday, July 21, 2012 8:07 PM
  • Well, may be xml will work then. I just want to keep it simple.
    Saturday, July 21, 2012 9:40 PM
  • Dig it out of the HTML source for a web site that has the info you want.

    You can also get an RSS feed from NOAA.

    You can also get hourly global weather formatted updates form NOAA.
    • Edited by JohnWein Saturday, July 21, 2012 10:20 PM
    Saturday, July 21, 2012 10:15 PM