1
votes

What is the best way to implement a weather web part for 2007 sharepoint. I want the web part to automatically select the correct location based on the users profile settings or maybe IP range.

Or should I make the webparts connectable to another webpart where the user enters the location?

I would appreciate guidance on how to do this.

Many Thanks,

2

2 Answers

2
votes

A connection is probably not needed, all logic could be contained in the webpart (plus maybe custom editorpart). If you make the webpart configurable by end users it needs to be personalizable at the least.

There are sites (like Yahoo weather) that have javascript API's to get weather info based on zipcode / location. To get a user's geographical location, you need an IP to location database.

You could use MaxMind's GeoLite City free database, it maps IP addresses to geographical locations. Because it's free it is not accurate up to a meter, but for weather i'd say accurate enough. The database is updated monthly and comes in both binary and csv format (so you could import the csv into a SQL database). More info here.

Once you have a geographical location you can use Yahoo's weather API to get the info. Then parse and style the result.

P.S. GeoLite City is just an example, there are similar products out there, this is just the one I found googling, I Have no affiliation with them or anything like that.

2
votes

The simplest way is to simply add in a Page Viewer web part, and use this for a the link:

http://www.bing.com/webslices/answer.aspx?q=weather&a=WeatherAnswer&s=Weather&form=IE8WSV

That will display the weather for the current user's general IP address area. You can customize the link to include specific zip codes, if you like, by chaing the "q=weather" to "q=weather XXXXX", where XXXXX is the zip code.

The next simplest is to use a Content Editor Web Part, and choose any of the weather gadgets on Google Gadgets. Once you find one you like in the Google Gadget area, click on "Get the Code", and then copy and pase the code into the "Source Editor..." area of the Content Editor Web Part.

If you would like a finished, free solution, you can use the Bamboo Solutions weather web part that they donated to the Community Kit for SharePoint project.

I'd post a link to that project, but the built-in spam protection here limits me to one link per answer. Do a google search for CKS Weather, and you will get the link from the first hit.