google weather api not working | Bytes (2024)

Home Posts Topics Members FAQ

gamer2d

google weather api not working | Bytes (1) 10 New Member

I need some help created a google weather api using vb .net.

I found the code online and there are no errors. Problem is that I can't seem to display wether information. Nothing shows up on screen and I am not sure what I did wrong. any ideas?

Expand|Select|Wrap|Line Numbers

  1. ImportsSystem.Net
  2. PartialClassUI_MasterPage
  3. InheritsSystem.Web.UI.MasterPage
  4. ProtectedSubSearchIB_Click(ByValsenderAsObject,ByValeAsSystem.Web.UI.ImageClickEventArgs)HandlesSearchIB.Click
  5. DimWeatherDataAsNewWeather.WeatherInfo_Typed
  6. WeatherData=Weather.Grab_Weather("albany")
  7. temp.InnerHtml&=WeatherData.location&"--"&WeatherData.forcast_date&"--"&WeatherData.checked_time_date&"--"&WeatherData.humidity&"--"&WeatherData.forcast_date
  8. EndSub
  9. EndClass
  10. <Runtime.CompilerServices.Extension()>
  11. ModuleWeather
  12. PublicStructureWeatherInfo_Forecast
  13. DimDayOfWeekAsString
  14. DimlowAsDouble
  15. DimhighAsDouble
  16. DimiconAsString
  17. EndStructure
  18. PublicStructureWeatherInfo_Wind
  19. DimdirectionAsString
  20. DimspeedAsDouble
  21. DimunitAsString
  22. EndStructure
  23. PublicStructureWeatherInfo_Typed
  24. DimFailedAsBoolean
  25. DimerrormessageAsException
  26. DimlocationAsString
  27. Dimforcast_dateAsDateTime
  28. Dimchecked_time_dateAsDateTime
  29. DimhumidityAsDouble
  30. DimhighfAsDouble
  31. DimlowfAsDouble
  32. DimhighcAsDouble
  33. DimlowcAsDouble
  34. DimcurrenttempCAsDouble
  35. DimcurrenttempFAsDouble
  36. Dimpredicted_iconAsString
  37. Dimcurrent_iconAsString
  38. Dimcurrent_conditionAsString
  39. Dimpredicted_conditionAsIEnumerable(OfWeatherInfo_Forecast)
  40. Dimwind_conditionAsWeatherInfo_Wind
  41. DimdayAsString
  42. EndStructure
  43. <Runtime.CompilerServices.Extension()>_
  44. PublicFunctionToC(ByValFAsDouble)AsDouble
  45. Return((F-32)/9)*5
  46. EndFunction
  47. <Runtime.CompilerServices.Extension()>_
  48. PublicFunctionTryParseAsDouble(ByValsAsString)AsDouble
  49. DimrvAsDouble
  50. IfDouble.TryParse(s,rv)=FalseThenrv=Double.NaN
  51. Returnrv
  52. EndFunction
  53. <Runtime.CompilerServices.Extension()>_
  54. PublicFunctionTryParseAsDate(ByValsAsString)AsDateTime
  55. DimrvAsDateTime
  56. IfDateTime.TryParse(s,rv)=FalseThenrv=Nothing
  57. Returnrv
  58. EndFunction
  59. PrivateFunctionParseHumidity(ByValsAsString)AsDouble
  60. IfNotsIsNothingThen
  61. DimhumRegExAsNewSystem.Text.RegularExpressions.Regex("Humidity:(?<Value>\d+)\w*\%")
  62. Dimm=humRegEx.Match(s)
  63. Ifm.Length=0ThenReturnDouble.NaN
  64. ReturnDouble.Parse(m.Groups("Value").Value)
  65. EndIf
  66. EndFunction
  67. PrivateFunctionParseWind(ByValsAsString)AsWeatherInfo_Wind
  68. DimrvAsNewWeatherInfo_Wind
  69. IfNotsIsNothingThen
  70. DimhumRegExAsNewSystem.Text.RegularExpressions.Regex("Wind\:\s+(?<Direction>[NEWSnews]{1,2})\s+at\s+(?<speed>(?<value>\d+)\s(?<units>\w+)){1}")
  71. Dimm=humRegEx.Match(s)
  72. rv.speed=Double.NaN
  73. Ifm.Length=0ThenReturnrv
  74. Withrv
  75. .direction=m.Groups("Direction").Value
  76. IfDouble.TryParse(m.Groups("value").Value,.speed)=FalseThen.speed=Double.NaN
  77. .unit=m.Groups("units").Value
  78. EndWith
  79. EndIf
  80. Returnrv
  81. EndFunction
  82. PublicFunctionGrab_Weather(ByValLocationAsString)AsWeatherInfo_Typed
  83. DimGrabWeatherAsNewWeatherInfo_Typed
  84. WithGrabWeather
  85. .Failed=True
  86. Try
  87. DimxmlAsXDocument=XDocument.Load("http://www.google.com/ig/api?weather="&Location)
  88. Dimxp=xml.<problem_cause>
  89. Ifxp.AnyThenReturnGrabWeather
  90. .location=xml...<city>.@data
  91. .forcast_date=xml...<forecast_date>.@data.TryParseAsDate
  92. .checked_time_date=xml...<current_date_time>.@data.TryParseAsDate
  93. .humidity=ParseHumidity(xml...<humidity>.@data)
  94. .highf=xml...<high>.@data.TryParseAsDouble
  95. .lowf=xml...<low>.@data.TryParseAsDouble
  96. .highc=GrabWeather.highf.ToC
  97. .lowc=GrabWeather.highc.ToC
  98. .currenttempC=xml...<temp_c>.@data.TryParseAsDouble
  99. .currenttempF=xml...<temp_f>.@data.TryParseAsDouble
  100. '.current_icon="http://www.google.com"&xml...<icon>.@data
  101. '.predicted_icon="http://www.google.com"&xml...<high>.@data
  102. .current_condition=xml...<condition>.@data
  103. .predicted_condition=FromfInxml...<forecast_conditions>_
  104. SelectNewWeatherInfo_ForecastWith{_
  105. .DayOfWeek=f.<day_of_week>.Value,_
  106. .high=f.<high>.@data.TryParseAsDouble,_
  107. .low=f.<low>.@data.TryParseAsDouble}
  108. '.icon="http://www.google.com"&f.<icon>.@data}
  109. .wind_condition=ParseWind(xml...<wind_condition>.@data)
  110. .day=xml...<day_of_week>.@data
  111. .Failed=False
  112. ReturnGrabWeather
  113. CatchexAsException
  114. .errormessage=ex
  115. ReturnGrabWeather
  116. EndTry
  117. EndWith
  118. EndFunction
  119. EndModule

Jul 9 '15 #1

Subscribe Reply

0 google weather api not working | Bytes (2) 1505 google weather api not working | Bytes (3)

Sign in to post your reply or Sign up for a free account.

Similar topics

13 2361

script for google?

by: Mario |last post by:

Hello everybody, I am looking for a good script to work a searchprogram for Google .... How can tel me? Not with a logo from google THnx -- -------"""------- ---()--- °?----(_)-----?° | Greetz Mario|

Javascript

3 2539

Weather Prediction Program Help

by: JamesLomuscio |last post by:

To all who know C++, Im working on a prog that will be able to predict the weather, its too complicated to go into here, but I do need some help. I need to grab all of the information in the file currdat.lst that is in quotes and store them in variables. Sounds simple enough, right? This area of my prog. is complete garbage, so I wont bother to post it. For anyone interested in helping, the next line is line one of

C / C++

3 1969

Weather Service Webservice Issues

by: sduncansca |last post by:

Hello We have been using the the National Weather Service webservice(http://www.weather.gov/xml/) for a while. A couple weeks ago they made some changes and moved the url of the wsdl(http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl). I changed the wsdl location in my project and refreshed the web references, but now I am getting error "The underlying connection was closed: The server committed an HTTP protocol violation."...

ASP.NET

6 2129

Google and Asp.Net

by: shapper |last post by:

Hello, If you make a search in Google for "CNN" you will get the result as follows: CNN.com - Breaking News, US, World, Weather, Entertainment & Video ... CNN.com delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and more. www.cnn.com/ - 99k - Cached - Similar pages

ASP.NET

1803

" Working in Faith watch this "

by: WORKING IN FAITH |last post by:

three years I LOVE You Monica More options 1 message - Collapse all WORKING IN FAITH View profile More options Nov 13, 11:29 am three years I LOVE You Monica

PHP

4 5381

Weather Feed and difficulties

by: Jake G |last post by:

Hi all, I am trying to get a current weather conditions feed working. Yahoo provides a free feed @ http://weather.yahooapis.com/forecastrss?p=XXXXX where XXXXX is a valid US zip code e.g. (http://weather.yahooapis.com/forecastrss?p=43221) The feed is documented @ http://developer.yahoo.com/weather/ This works fine. Where I run into trouble is learing how to use this

Javascript

1 2520

JavaScript implement weather forecast can't run in Firefox

by: Wei Jia |last post by:

1.Ajax. 2.http://j.maxmind.com/app/geoip.js for get client city. 3.Google weather API. IE test is passed!But others browser can't,why? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML>

Javascript

1102

JQuery Script Not Working:

by: neilsy |last post by:

So I'm a nube when it comes to JQuery and JavaScript as I mostly write PHP. My Jquery connection via google is working as I've tested it. However I'm not sure whats the problem is. The code is designed to count new messages and display the number of new messages. Code as follows: <script> $(document).ready(function() { var refreshId = setInterval(function(){ $.ajax({ type: "GET", url: "include/php/inboxcount.php", data: 'p=' +<? echo...

Javascript

8683

What is ONU?

by: marktang |last post by:

ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...

General

8611

Changing the language in Windows 10

by: Hystou |last post by:

Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...

Windows Server

9031

Maximizing Business Potential: The Nexus of Website Design and Digital Marketing

by: jinu1996 |last post by:

In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...

Online Marketing

8876

Discussion: How does Zigbee compare with other wireless protocols in smart home applications?

by: tracyyun |last post by:

Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...

General

1 6531

Access Europe - Using VBA to create a class based on a table - Wed 1 May

by: isladogs |last post by:

The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...

Microsoft Access / VBA

5867

Couldn’t get equations in html when convert word .docx file to html file in C#.

by: conductexam |last post by:

I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...

C# / C Sharp

4624

Windows Forms - .Net 8.0

by: adsilva |last post by:

A Windows Forms form does not have the event Unload, like VB6. What one acts like?

Visual Basic .NET

2 2341

How to add payments to a PHP MySQL app.

by: muto222 |last post by:

How can i add a mobile payment intergratation into php mysql website.

PHP

3 2007

Comprehensive Guide to Website Development in Toronto: Expert Insights from BSMN Consultancy

by: bsmnconsultancy |last post by:

In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

General

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisem*nts and analytics tracking please visit the page.

google weather api not working | Bytes (2024)

References

Top Articles
Latest Posts
Article information

Author: Gov. Deandrea McKenzie

Last Updated:

Views: 6492

Rating: 4.6 / 5 (46 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Gov. Deandrea McKenzie

Birthday: 2001-01-17

Address: Suite 769 2454 Marsha Coves, Debbieton, MS 95002

Phone: +813077629322

Job: Real-Estate Executive

Hobby: Archery, Metal detecting, Kitesurfing, Genealogy, Kitesurfing, Calligraphy, Roller skating

Introduction: My name is Gov. Deandrea McKenzie, I am a spotless, clean, glamorous, sparkling, adventurous, nice, brainy person who loves writing and wants to share my knowledge and understanding with you.