September 2012, Google stopped his weather API, so my module does not work anymore. I don't plan to fix the situation.

Comments

ica’s picture

Nice one Jeff thank you, previous weather.module one stopped working

i installed to my local
I got
Drupal 4.6.2
browsers (mac);
safari
firefox
a glitch
- weather icons does not show up
suggestions
- it would be nice if you use other icon sets
there are 23, 25, 32, 36 and large 52 px sets on the weather.com
ideally small 23 medium 32 can give enough nice options
and also would be nice if users choose those (small, medium) icon sets with a dropdown option on
admin>settings>weather
- an also an option to show without the icons
- I liked the multiple location option
- Daily and 5 days forwardcast option like in the Weather.com would be nice in the main body.
- Ideally instead of looking the location codes how about a dropdown option of cities
dropdown [select a city]
[Paris] that will give value FRXX0076

i looked and could not find all values in text format
i gt this for the US but not an exact use for the module as it is
http://weather.unisys.com/noaaport/text_summary.html

I found weather module for postnuke
http://www.keopsonline.com/portal/modules.php?op=modload&name=Downloads&...
-(borttom of the page)
I downloaded it and it has a 'data' folder in it with php files for countries, each country has a file (280 country/php. file for each 3MB total!) .
example: > data/albania.php ;

$city_name = 'Albania';
$city_version = 1.0;
$subdiv_id = 250;
$country_id = 183;
$region_id = 7;
$city_data = array();
$city_data[] = array('accid' => 'ALXX0001', 'name' => 'Shkoder');
$city_data[] = array('accid' => 'ALXX0002', 'name' => 'Tirane');

Albania has 2 cities defined, other countries like France has 200 so cities and 400 lines, so its a weath of info and choice but makes file larger.. it can still be used and let individuals elinate unwanted country files

errr, sorry Jeff you wanted a short feedback maybe i was taking over by ideas and not sure if they any use for you or any feasable :(
but anyway you possible though about them already :)

regards

iamjeff’s picture

Thanks for your feedback !
I'm already still working for the next release and especially to make this module becoming much more user friendly to administer.

ica’s picture

Jeff I am pleased that you found my feedback positive

I got another idea but I am nor sure its feasable as I can not code PHP

The idea is to hack apple Dashboard widgets.
There are plenty of them and you can look at the code I am on Apple i am not sure you can download them if you are on WinLinux
http://www.apple.com/downloads/dashboard/

...and there is BBC weather widget (maybe BBC is more reliable than weather.com?)
http://www.bbc.co.uk/weather/
Here is the widget download
http://www.apple.com/downloads/dashboard/information/bbcweather.html

Inside the folder you get;
BBC Weather
-bbcLocation.js
-bbcPrefs.js
-bbcWeather.html
-bbcWeather.css
-icons[folder]

they seem easy to hack when i looked at the code
- mind you I dont have coding skills :)

if you can not download (if you can not i can attact the .zip file somewhere on your site - or paste the codes here?) for you to look at.

With a courage of an unskilled in coding but with ideas :) I have tried to hack couple of widgets.

The idea is putting the .html code into a Drupal page or to a html block and changing the .js .css and image reference files into here (I FTP'ed those files into drupal/files/widget)

but so far this method did not worked for me. I guess its beacuse of my lack of coding skills. In theory this method should work somehow, maybe you or someone else can take on the idea and show us how to.

ica’s picture

Could you find time to look up to the icon images hitch

ther are referenced to
weather dir, example
/weather/32x32/34.png
but they dont show up

i tried to chance the reference to
/modules/weather/32x32/34.png
weather.module on line 133
img src=\"weather/32x32/"

...nope it did not worked either
maybe its to do with weather.module location
modules/weather/modules/weather.module
and the icons on 1 up directory
/modules/32x32/

how icon images not shoing up can be fixed?

iamjeff’s picture

you must copy the weather.module in the modules directory of drupal.
For the images, you must copy the weather directory in the root of your drupal install.

ROOT
|....
|-includes
|-misc
|-sites
|-modules
|-weather
    |--- 32x32

The weather directory must include the following files :
index.php
pngfix.js
TWClogo_32px.png
And all the images in 32x32

I will try to improve the notes about installation ;)

ica’s picture

i followed yu instructions above and it worked.
Since your weather module has unusal module structure compare to the conventional Drupal module dir. structure - I have to admit I did not read the install document carefully. - i just 'looked' at it :)
Yes a better install notes may help the sloppy users like me :)

thanks!

sepeck’s picture

to put it so that the weather module images are self contained as sub directories of the image module directory? This helps keep all the files contained within itself and makes it less likely that a directory will get missed/etc.

Also, you should consider requesting cvs access and request rights to take over and replace the old weather module as it has not been really maintained for a while.

-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

lennart’s picture

If you want to use AJAX for your weather.module see this:

http://openrico.org/rico/demos.page?demo=ricoWeather.html

Best regards,
Lennart

Best regards,
Lennart

Hosting Geek’s picture

nice stuff there

paddy_deburca’s picture

Hi Jeff,

I have hacked a bit at the previous weather module (that stopped working as the XML feed stopped working)..

I updated the code to use a choice of rssweather.com or weather.gov as weather sources. The module is also available for download.

You can see it working on http://amadain.net

This module already used caching quiet extinsively and I have tried to improve it so reduce load on weather servers. You can see in the code how the difference weather feeds are decoded.

I am trying to create a theme on hamweather that will provide an XML data feed rather than a web page.

I am also contemplating on creating an integration module between hamweather and drupal.

Paddy.

http://deburca.org, and http://amadain.net

ica’s picture

Hi paddy,

i have tried your update to the weather.module
I have wrote over the old weather.module
Changed the values on
admin/settings/weather
I put the city code
- only rssweather option works

but when I clicked on the [View the 5 day forecast.]
it goes to the directory correctly
/weather
but..it does not show up
I am not sure its todo with my drupal settings or a bug

Also because Jeffs module also called weather.module
it creates confusion.
it could be related to this?

please let me know any others experience this
that or any ideas on this
---------------
[View the 5 day forecast.] from the weather block
it goes to the directory correctly
/weather
but..it does not show up
or -weather block works but NOT
/weather
---------------------------

maybe Jeff or you should change the names to something else
or better you combine your work so all your code compliments eachother rather than confuse or conflict

~thanks!

paddy_deburca’s picture

I have hacked a bit with rssweather and have never succeeded in getting the 5 day forecast working. All the original code is there in the module - but I never got it to work.

This is why I want to try and integrate hamweather into drupal and why I am trying to create a hamweather XML feed. When I have the XML feed up and running I'll re-work the weather module and try to get the 5 forecast working.

Decoding XML in PHP is far simpler than HTML scraping...

Paddy.

http://deburca.org, and http://amadain.net

ica’s picture

great!

+ what do you thinking of the module naming conflict of Jeff's module and the 1 you are working on? or Jeff what do you think?
considering joinging he effords or working sepeartely as 2 different weather modules?

- Sepeck above suggested Jeff to 'cvs access and request rights to take over and replace the old weather module' which is sensible

at least naming your Hamweather port to Drupal needs renaming maybe.

I just checked
http://www.hamweather.com/
It looks good
- oh it would be even nicer if Weather Maps/Radar integrated too -if its allowed somehow :)

~regards

paddy_deburca’s picture

Hamweather allows a lot - you just need to add the hamweather credit.

Also with hamweather there is a community developing solutions at, with a bit of careful poking and prodding, we should be able to fit with Drupal.

As I said, I will try to set up an XML weather feed. I will also try to integrate hamweather.

So I will try to create two modules
1. hamweather - integrated hamweather
2. xmlweather - weather module feeding from xml weather feeds

Paddy.

http://deburca.org, and http://amadain.net

paddy_deburca’s picture

My first attempt at integrating HAMweather.com into drupal can be seen on http://amadain.net/?q=hamweather&forecast=zandh&pands=ELLX.

hamweather in installed locally and heavily modified to allo embedding.

I will re-engineer these modification to follow good programming practice and propose these changes to the hamweather support team.

I still have some blocks missing and the URLs need to be massaged to work.

Paddy.

http://deburca.org, and http://amadain.net

iamjeff’s picture

I think the best is to create two different projects because it can become difficult to synchronize efforts and ideas.
Each module can offer a solution who will suit needs of different people. I'm working on fixing some things in the code to follow rules defined for the xml services. It seems that It's not allowed to display 5 weathers in the same time. And the use of only one account hardcoded for the module can't be used either.
I've also to implement the caching based on the code coming from the previous weather module.

If you want to stay informed of the weather's module updates, you can register on my page.

I will ask for cvs access when the module will reach maturity.
Don't hesitate to send me feedbacks or comments by mail. Thanks !

ica’s picture

It was working fine for a while
than i get this
------------------------
Current weather conditions for Slow Down
Please reduce the number of requests you are making for this weather feed. The weather gets update about once an hour, you last received the weather information00 minutes and 01 seconds ago. Please amend your request frequency in order that rssWeather.com can continue to run.

--------------------------------

How can I reduce the 'number of requests '?
i ticked on than off

-Extra Options
-Block re-caching
(Updates weather block in cached pages for anonymous users)
-Enable cron
(Auto-parsed weather data using drupal's cron system)
but it did not changed the 'warning' above

paddy_deburca’s picture

The module uses Drupal cache to store requests for up to 1 hour.

Successive requests within the hour should be satisfied by the cache. This at times does not work and the weather server, quiet rightly, complains.

What I have done in the most recent version of the module

  • store only successful requests in cache
  • if a 'Slow Down' is received from the weather server, retrieve the previous good request from cache, and update cache with a new time stamp

I have put the new version on http://amadain.net for download.

I will have to dig deeper into Drupal caching to see why this problem happens.

Paddy.

http://deburca.org, and http://amadain.net

paddy_deburca’s picture

I have finally tracked down why the weather.module was not caching results correctly.

In /includes/bootstrap.inc, the cache_get function did not return the 'expire' field.

I simply added expire to the list of fields in the SELECT statement - and hey presto!!

I checked Drupal CVS and this upadate (+ many others) are already made.

Paddy.

http://deburca.org, and http://amadain.net

val@lovefromthesun.com’s picture

I have something similar at my site, but I haven't coded it as a module. I just have a custom block that includes a separate php file. Let me know if you want my code.

My site is here:
http://www.lovefromthesun.com

lennart’s picture

Can we get the code ?

Best regards,
Lennart

Best regards,
Lennart

val@lovefromthesun.com’s picture

I just realized there's a ton of icons as well, so it would be hard to post the code. I'll see about making it available from my site, which should now be aggregated by planet drupal. For now, if you really want it, email me val -AT- lovefromthesun.com and I'll send you a tarball.

My only problem is, I just realized that the xml file I download from weather.com to parse says something about how it's only for authorized users. Does anybody know about the legal issues of that? Presumably, they don't really want people stealing their data and displaying it on their site. Is it all good if you just credit them? I don't really know much about legal/licensing issues....

paddy_deburca’s picture

The weather module can also use http://rssweather.com to retreive weather information.

The code already exists to de-code the rssweather XML stream. I can post the precise code if you wish.

Paddy.

http://deburca.org, and http://amadain.net

amagab’s picture

val> I love your weather block and would very much like to have it on my site.

Could someone PLEEEEAAASE email the needed stuff (code and images) to:
amagab AT gmail.com

Many thanks!

paddy_deburca’s picture

You can download it from You can download it from http://amadain.net/?q=system/files&file=weather.module

PLEASE update the cache_get function /includes/bootstrap.inc to return the value of expire. Otherwise the weather feed will be polled at each and every page refersh - which annoys the weather feed and slows down your page refresh.

function cache_get($key) {
  $cache = db_fetch_object(db_query("SELECT data, created, expire, headers FROM {cache} WHERE cid = '%s'", $key));
  ...
  ...

Paddy.

http://deburca.org, and http://amadain.net

alexkb’s picture

Thanks for sharing this great module, with us all, Jeff and paddy_deburca.

I've made a hybrid version of the two, which implements caching and shows more regions.

http://www.akb.com.au/temp/weather.module

I messed with the display code a bit, because I didn't need the icons, and sunrise/set data..

Anyway, it's probably not very useful for anyone to use.. but it might be useful for someone trying to implement the same thing into their code.

- Alex (optik)

snackmaster’s picture

How to display in the content area of a webpage?

I get this error:
warning: call_user_func_array(): First argumented is expected to be a valid callback, 'weather_show' was given in /home/northbro/public_html/includes/menu.inc on line 354.

bomarmonk’s picture

I used paddy's module for awhile and it worked, but it seemed to dramatically slow down page loads for my site. Anyone else have this problem or know of a way to use a weather block without adversely affecting performance? I have a lot of modules installed already, so it might just be that one more breaks the camel's back.

paddy_deburca’s picture

The cache_get function in /includes/bootstrap.inc to support the expire parameter? Without this fix the module contacts the weather source at each page load instead of every hour.

I am working on updating the module for 4.7 is should be ready soon.

Paddy.

http://deburca.org, and http://amadain.net

n3IVI0’s picture

They're all broken. Every one. The only one that comes close to working is paddy's. It will activate, can be configured, and will display weather data in a block, but if you try to configure the block (so it only displays on certain pages for example), you get this error: Invalid argument supplied for foreach() in /.../.../.../includes/form.inc on line 337.

So, any possibility of a working weather module for 4.7? Thanks!

paddy_deburca’s picture

UPDATE: I believe that I have found the bug in question. Please download and test the weather module again. http://amadain.net/?q=node/24

Paddy.

I have the weather module up and running on my amadain.net site. Since the update to 4.7RC I have only had one issue - and that is exactly what you are experiencing.

It is all to to with the #ref value of the form. I get

Fatal error: Cannot create references to/from string offsets nor overloaded objects in [snip]/includes/form.inc on line 341

I have looked into this - but I do not know the 4.7 forms API well enough to fix the problem.

Your post has reminded me of this issue - I will try my best to resolve it.

Paddy.

http://deburca.org, and http://amadain.net

n3IVI0’s picture

That got it. Thanks paddy....

iamjeff’s picture

I just released a new version of my weather module for drupal 4.7

hounselb’s picture

Hi
I have just installed the weather module and it works perfectly - however I would like to get rid of the Block 'Title' i.e. set it to in the block configuration page but when I try to access the config screen (index.php?q=admin/build/block/configure/weather/0) I just get an empty page. I am new to Drupal so any pointers would be greatly appreciated.

Cheers

waqsajaz’s picture

Please let me know if u get any updates on this.. thnx