Sunday, February 26, 2012

Weather Geocoder with Google Maps and Google Weather API

Google Weather GeocoderI got tired of searching locations on weather reporting websites to get instant updates, so I thought of building an instant weather reporting application which would give me information for any location I click on the map. Google Maps API provides an inbuilt reverse-geocoding service which can geocode an IP Address to a place on the map. To get weather information, I’ve used the so called secret Weather API from Google which they use on the iGoogle page widget. Google has not officially published this API but we would love if they do so. The good thing about Google’s weather API is that it is easy to use and includes the weather icons, but there is no way as of now to get the data in other formats apart from XML:
http://www.google.com/ig/api?weather=Chicago.

Demo on my Labs page: http://lab.abhinayrathore.com/geocode_weather/

You can play around with the app on my labs page and view the source on the page to get the JavaScript code to build this tool on your own website. To convert the XML data from Google Weather API to JSONP, I’ve written a small PHP script you can download from the link below.

Click here to get the PHP Script for converting Google Weather API’s XML data to JSON/JSONP format.

You can style the Weather Information window according to your needs or you can use the one I’ve created: http://lab.abhinayrathore.com/geocode_weather/weather.css. You can freely modify the JavaScript code to suit your needs. If you find any bugs or see improvement opportunities, please do drop a comment below and I’ll look into it asap :)

41 comments:

  1. hi, nicely done there great job! and thanks for sharing
    but i have a question...
    is there a way to overcome the PHP Script for converting Google Weather API’s XML data to JSON/JSONP format and converting the original xml file google creates at "http://www.google.com/ig/api?weather=Chicago" to plain html using jquery?

    ReplyDelete
  2. Anonymous,
    Instead of converting the XML to JSONP (I designed it for cross-domain access), you can write a simple proxy script in any language to fetch the Google XML from your JavaScript code. Then you can parse the XML file in jQuery (http://api.jquery.com/jQuery.parseXML/) and get the weather data in formatWeatherData() method.

    ReplyDelete
  3. i've tried that exactly,but i get (in google chrome's inspect element) this error...
    "XMLHttpRequest cannot load file:///C:/Users/andry/Desktop/2.xml. Origin null is not allowed by Access-Control-Allow-Origin."

    and i cant rly think what i did wrong there, thank you again in advance

    ReplyDelete
  4. If you have the XML file locally, then try placing it in the same folder as your script and simply use "2.xml" (without any path) in the ajax call. The best option is to use a proxy script to get the xml data.

    ReplyDelete
  5. Hi,
    The weather google api cannot be used. They treat thee request to get the xml file as an automated query, and just outputs this message:
    We’re sorry… … but your computer or network may be sending automated queries. To protect our users, we can’t process your request right now.

    ReplyDelete
    Replies
    1. Google Maps API provides an inbuilt reverse-geocoding service which can geocode an IP Address to a place on the map. To get weather information, I’ve used the so called secret Weather API from Google which they use on the iGoogle page widget. Google has not officially published this API but we would love if they do so. The good thing about Google’s weather API is that it is easy to gta apk san andreas

      Delete
  6. i am getting this error when using your demo page. I am using firefox 13.0.1

    'Error occured during fetching weather data."

    Glenn

    ReplyDelete
  7. Hi. I converted your app to a python/google app engine application. I used weather underground api and it is working fine.

    ReplyDelete
  8. QuickBooks Payroll Support – When it comes to managing accurate financial records, then, QuickBooks name is on the top. QuickBooks has garnered a wide appreciation from the business field. QB name shines in the business world with QuickBooks Payroll feature.

    ReplyDelete
  9. Very nice!!! This is really good blog information thanks for sharing. We are a reliable third party QuickBooks help company offering technical support for various any types of technical errors.

    ReplyDelete
  10. There can be various problems you can encounter while using your printer and the Epson Printer Offline issue is one of them. You can visit the page and get immediate answers.

    ReplyDelete
  11. Thanks for sharing such an informative post.
    However, at times they face few errors with, QuickBooks Online login problems on Chrome when signing in on the Intuit official website.

    QuickBooks File Doctor | QuickBooks Install Diagnostic Tool

    ReplyDelete
  12. Thanks for sharing such an informative post.
    We hope you find this article helpful in solving the issues that QuickBooks Error Code 15270. Also, if you are facing issues even after performing the solutions provided here, you can call our Resolve Pdf and Printing Errors with QuickBooks Desktop Team at +1(800)-880-6389 and speak to certified experts.

    ReplyDelete
  13. Presently, technology is changing at a snappier pace than at any other time. With all the development in innovation comes the expanding number of opportunities for cybercriminals to mishandle. As an outcome, cybersecurity has become incredibly fundamental so as to protect persona, shoppers, and business data against different dangers. On the off chance that you don't have the suitable wellbeing systems set up, at that point you are at a danger of digital assaults. McAfee antivirus bans all the infections and malware from entering and contaminating the framework.

    mcafee activate |
    mcafee activate |

    ReplyDelete
  14. Presently, technology is changing at a snappier pace than at any other time. With all the development in innovation comes the expanding number of opportunities for cybercriminals to mishandle. As an outcome, cybersecurity has become incredibly fundamental so as to protect persona, shoppers, and business data against different dangers. On the off chance that you don't have the suitable wellbeing systems set up, at that point you are at a danger of digital assaults. McAfee antivirus bans all the infections and malware from entering and contaminating the framework.

    mcafee activate |
    mcafee activate |

    ReplyDelete
  15. AntiVirus-Norton is the passage level antivirus arrangement offered by the organization. It gives different layers of continuous security against all types of noxious programming, for example, infections, spyware, Trojans and others.
    norton.com/setup |
    norton download |
    norton account

    ReplyDelete

  16. i am a it softwere analyst,i have a project(website) to promote on google search engin.here is something about my project. iamcafee is a free specialized help specialist organization for McAfee items. We are a free help authority association for programming related issues in compact PCs, work areas, contraptions and peripherals. Use Of McAfee Name, logo, trademarks and its pictures is only for reference and not the smallest piece recommend that mcafee.com has any business association with McAfee. McAfee trademarks, names, logo and pictures are the property of their different owners. We holds no connection or relationship with any of these brands or untouchable associations and solely offer assistance advantage for the thing issues went up against by customers. If your item is under guarantee, you may get free help administration from the brand owners.
    mcafee.com/activate |
    mcafee activate |



    ReplyDelete
  17. Thank you for sharing this wonderful article, And it is very useful information norton.com/setup
    www.norton.com/setup

    ReplyDelete
  18. I am very happy to read your article whenever I read it I found something new and interested information in your blog. Thank you so much for share this informative information with us and all the best for the next comment. mcafee.com/activate, www.mcafee.com/activate, mcafee activation code

    ReplyDelete
  19. This is an informative post. Thank You for sharing this.
    This error might result in losing the unsaved data. The user can only click on the On tab on hovering over the QuickBooks Multi-User Mode Not Working Problem message.

    QuickBooks Abort Error | QuickBooks Unrecoverable Error

    ReplyDelete

  20. Stumbled on Quickbooks multi-user mode not working error?

    Well, Quickbooks multi-user mode not working error would have occurred due to:
    QuickbooksDBXX services have not started yet.
    .TLG file is corrupted.

    What can be done to fix Quickbooks multi-user mode not working error?
    Check if the Quickbooks services are running.
    To see this, go to service.msc from the windows search bar and check if QuickbooksDBXX service is there in the windows list.

    To conclude!!
    “Quickbooks multi-user mode not working error” is now averted!! If you are still facing any issues in fixing Quickbooks multi-user mode not working error, you can reach out to QBSsolved at 1-888-910-1619.

    ReplyDelete
  21. Quickbooks deals with the financial accounting works in your businesses. But it may encounter several errors like Quickbooks unable to verify financial institution errors.

    Causes of Quickbooks unable to verify financial institution error:
    Quickbooks may be older than three years.
    Bank or credit card may not be recognized by Quickbooks.
    .QBO file was not created properly.
    .QBO file must have been built by the third party services.

    ReplyDelete
  22. Canon Printer in Error State is a totally common trouble faced by customers all over the world. If you're looking for assist to put off it, the following manual will assist

    ReplyDelete
  23. Nice blog.

    Global small molecule active pharmaceutical ingredient (API) market will reach $266.2 billion by 2027, growing by 7.3% annually over 2020-2027

    ReplyDelete
  24. quickbooks error 3371 status code Caused By Missing Or Damaged Data File: Could Not Initialize License Properties Error Code 3371 Could Not Load The License Data.

    ReplyDelete
  25. Very nice blog!

    You can fix the PS033 error by renaming the CPS folder to CPSOLD by locating the folder.


    For better assistance in fixing Quickbooks Enterprise error PS033 , call QBS solved at +1(888) 910 1619

    ReplyDelete
  26. Its a great pleasure reading your article post.Its full of information I am looking for and I love to post a comment that “The content of your post is awesome” Great work.



    QuickBooks Cannot Communicate with the Company File


    QuickBooks Error 12002


    QuickBooks Component Repair Tool Diagnose Errors


    QuickBooks Multi Currency Problem


    QuickBooks Web Connector Error QBWC1085

    ReplyDelete

  27. The primary reason that triggerserror 1723 quickbooks Desktop is errors in the Windows installer and its service. However, there are few other reasons as well that might cause error 1723 installing QuickBooks Desktop that we have to follow few steps such as outdated Windows operating system and its features. Secondly, Windows is busy installing some other programs in the background

    ReplyDelete
  28. QuickBooks Error 1904 is a typical problem that occurs after upgrading the operating system and installing QuickBooks.

    ReplyDelete


  29. This article is very much helpful and i hope this
    will be an useful information for the needed ones.
    Keep on updating these kinds of informative things...
    IF you need anytype of help regarding Microsoft Office. We provide support for Microsoft office
    office-setup-key
    and office-setup

    ReplyDelete
  30. Quickbooks is the most efficient software for accounting programs of any business. However, Quickbooks is sometimes hampered by certain errors and these issues are the integral parts of Quickbooks. Quickbooks TLS error is one of such errors that affects quickbooks. Quickbooks TLS error comes up with the message stating “Quickbooks TLS 1.2 failure error”.
    https://www.qbssolved.com/quickbooks-tls-error-online-internet-explorer-security-changes/

    ReplyDelete
  31. How Many People Can Be On A Mortgage - It's very common for more than one person to be on a mortgage. The question is, how many people can you include on your mortgage? The answer is typically three or four. But there are certain circumstances where more than one person can be included on the same loan. For example, a lender may not allow you to put more than two people on the mortgage, or only two people can be on the loan. How Many People Can Be On A Mortgage

    ReplyDelete
  32. If you're wondering How To Get Rid Of Earwig In Your House, you've come to the right place. This article will give you the information you need to get rid of earwigs. The first step is to seal up your house's cracks and holes. Try to find areas where water leaks from your pipes or hot spots. If you can't find any, try to use a dehumidifier or apply a liquid pesticide to those areas. If those methods aren't working, you can always use natural scents.
    How To Get Rid Of Earwigs In Your House

    ReplyDelete
  33. What Is the Cheapest Type of House to Build - There are many different types of homes you can build, but there are a few common choices when it comes to the cheapest house to build. A simple square or rectangular home is usually the most affordable. These are also the easiest to construct, since they do not require elaborate angles or bump-outs. While you can also add landscaping to give your house a more attractive look, this type of construction is expensive.

    ReplyDelete

Thanks a lot for your valuable comments :)