PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)
- MonyMony
- Forecaster
- Posts: 180
- Joined: Sun Aug 20, 2017 12:54 pm
- Location: Elkton, Maryland, US
- Station model: Davis Pro 2
- Software: WeatherCat/Meteobridge
- Contact:
PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)
Hello All,
While I cringe with what has become of WeatherUnderground these days, there was one block I did like to use on my homepage that pulled WU data to show both my dad and father-in-law weatherstations. The PartnerStation block was a quick way to show this information so I spend a little time and reworked a bit of Jachym's code to make it compatible with the recent changes. The changes update the URL the codes uses along with changes for the new XML format WU puts out. I also added to the path the required API key variable you now need to gather the data.
To use this you can just replace your existing v3.0 version of the partnerStationBlock.php file with the attached update (other files in the block remain the same). Just remember that you need to make sure that in your Meteotemplate Main Setup configuration settings that you include your WU API key. If you upload your data to WU then this key is free and available under your account information.
Maybe this might be of use to someone. Enjoy!
p.s. To see an example of this block 'in action' check out my site (www.cecilweather.com) and look to the bottom-left of the page.
While I cringe with what has become of WeatherUnderground these days, there was one block I did like to use on my homepage that pulled WU data to show both my dad and father-in-law weatherstations. The PartnerStation block was a quick way to show this information so I spend a little time and reworked a bit of Jachym's code to make it compatible with the recent changes. The changes update the URL the codes uses along with changes for the new XML format WU puts out. I also added to the path the required API key variable you now need to gather the data.
To use this you can just replace your existing v3.0 version of the partnerStationBlock.php file with the attached update (other files in the block remain the same). Just remember that you need to make sure that in your Meteotemplate Main Setup configuration settings that you include your WU API key. If you upload your data to WU then this key is free and available under your account information.
Maybe this might be of use to someone. Enjoy!
p.s. To see an example of this block 'in action' check out my site (www.cecilweather.com) and look to the bottom-left of the page.
- Attachments
-
- partnerStationsBlock.php.zip
- Update partnerStationBlock.php file
- (2.81 KiB) Downloaded 134 times
Last edited by MonyMony on Wed Feb 26, 2020 1:28 pm, edited 1 time in total.
- John B
- Forecaster
- Posts: 211
- Joined: Sun Aug 20, 2017 11:59 pm
- Location: Blaxland, N.S.W., Australia
- Station model: La Crosse WS2355
- Software: Weather Display
- Contact:
Re: PartnerStation Block - Fixes for WU API Changes
Blimey, MonyMony, IF it helps someone? It certainly did for this little black duck.
Thank you, sir, for your time and trouble in researching the WU site and then amending the Meteotemplate file to suit. Your amended file worked 'out of the box' for me. I have only two 'partner' stations, one of which is that of my son (who lives about 750 metres above me farther up the mountains) and an old acquaintance's site (who runs one of the local official sites for the Australian Bureau of Meteorology); I am ever so pleased to regain access to their data within Meteo Template.
Again, my thanks.
Thank you, sir, for your time and trouble in researching the WU site and then amending the Meteotemplate file to suit. Your amended file worked 'out of the box' for me. I have only two 'partner' stations, one of which is that of my son (who lives about 750 metres above me farther up the mountains) and an old acquaintance's site (who runs one of the local official sites for the Australian Bureau of Meteorology); I am ever so pleased to regain access to their data within Meteo Template.
Again, my thanks.
- MonyMony
- Forecaster
- Posts: 180
- Joined: Sun Aug 20, 2017 12:54 pm
- Location: Elkton, Maryland, US
- Station model: Davis Pro 2
- Software: WeatherCat/Meteobridge
- Contact:
Re: PartnerStation Block - Fixes for WU API Changes
John B,
Glad my edits were helpful for someone!
It sounds like you just as I have two partner sites you typically display. While not included in my original upload, I did make a small edit so that the block shows both of my partner sites by default (i.e. the 'ALL' option). I did this by going to the end of the partnerStationBlock.php code and making the following changes:
Original Code:
Updated Code:
The key points are to change the line $("#partnerStationSelector").val(0); to $("#partnerStationSelector").val(all); (This is the drop-down list entry) and to change the next line from $("#partnerStation0").show(); to $(".partnerStationClass").show();.
Figured I would pass this on as well.
Jay
Glad my edits were helpful for someone!
It sounds like you just as I have two partner sites you typically display. While not included in my original upload, I did make a small edit so that the block shows both of my partner sites by default (i.e. the 'ALL' option). I did this by going to the end of the partnerStationBlock.php code and making the following changes:
Original Code:
Code: Select all
<script>
$("#partnerStationSelector").change(function(){
id = $("#partnerStationSelector").val();
if(id != "all"){
$(".partnerStationClass").hide();
$("#partnerStation" + id).show();
}
else{
$(".partnerStationClass").show();
}
})
$("#partnerStationSelector").val(0);
$("#partnerStation0").show();
</script>
Code: Select all
<script>
$("#partnerStationSelector").change(function(){
id = $("#partnerStationSelector").val();
if(id != "all"){
$(".partnerStationClass").hide();
$("#partnerStation" + id).show();
}
else{
$(".partnerStationClass").show();
}
})
$("#partnerStationSelector").val('all');
$(".partnerStationClass").show();
</script>
The key points are to change the line $("#partnerStationSelector").val(0); to $("#partnerStationSelector").val(all); (This is the drop-down list entry) and to change the next line from $("#partnerStation0").show(); to $(".partnerStationClass").show();.
Figured I would pass this on as well.
Jay
-
- Advisor
- Posts: 60
- Joined: Sun Dec 24, 2017 2:22 pm
- Station model: AW WS-2000ish
- Software: Meteobridge/OIP/GW-1000
- Contact:
Re: PartnerStation Block - Fixes for WU API Changes
Thanks for this, I will be implementing it on my site soon. Quick question - are you using a custom RadarUS block? I like how yours includes the WU and visible satellite images but that does not appear in the stock block. If so, do you mind sharing?
thx
Mike
thx
Mike
MonyMony wrote: ↑Wed Nov 27, 2019 2:00 am Hello All,
...
Maybe this might be of use to someone. Enjoy!
p.s. To see an example of this block 'in action' check out my site (www.cecilweather.com) and look to the bottom-left of the page.
- MonyMony
- Forecaster
- Posts: 180
- Joined: Sun Aug 20, 2017 12:54 pm
- Location: Elkton, Maryland, US
- Station model: Davis Pro 2
- Software: WeatherCat/Meteobridge
- Contact:
Re: PartnerStation Block - Fixes for WU API Changes
Hi Mike,
The answer is 'kind of'. I changed a bunch of the links back with the new GOES satellites went online and got creative with some of the other links. Its been a while but I take a look at what I changed and try and post my suggestions soon.
Jay
- MonyMony
- Forecaster
- Posts: 180
- Joined: Sun Aug 20, 2017 12:54 pm
- Location: Elkton, Maryland, US
- Station model: Davis Pro 2
- Software: WeatherCat/Meteobridge
- Contact:
Re: PartnerStation Block - Fixes for WU API Changes
Hi Mike,
I am attaching my modified radarUSBlock.php file to use as a reference. If you look to lines 86 thru 116 you can see the modifications I made for the drop-down lists. Most of the images come from https://cdn.star.nesdis.noaa.gov which if you poke around has a lot of options to pick from. The only non-public link I have is one from WeatherUnderground but as I still contribute data to them I believe it is still 'kosher' to link to (at least it used to be unless they changed something).
The odd thing with this block file is you have to made these modifications four times in the code as there are separate entries for each possible position/layout of the block. If you scroll down you will see things repeating and just have to repeat the same modifications for each section.
Hope this helps!
Jay
I am attaching my modified radarUSBlock.php file to use as a reference. If you look to lines 86 thru 116 you can see the modifications I made for the drop-down lists. Most of the images come from https://cdn.star.nesdis.noaa.gov which if you poke around has a lot of options to pick from. The only non-public link I have is one from WeatherUnderground but as I still contribute data to them I believe it is still 'kosher' to link to (at least it used to be unless they changed something).
The odd thing with this block file is you have to made these modifications four times in the code as there are separate entries for each possible position/layout of the block. If you scroll down you will see things repeating and just have to repeat the same modifications for each section.
Hope this helps!
Jay
- Attachments
-
- radarUSBlock.php.zip
- radarUSBlock.php with dropdown modifications
- (7.33 KiB) Downloaded 93 times
- John B
- Forecaster
- Posts: 211
- Joined: Sun Aug 20, 2017 11:59 pm
- Location: Blaxland, N.S.W., Australia
- Station model: La Crosse WS2355
- Software: Weather Display
- Contact:
Re: PartnerStation Block - Fixes for WU API Changes
It's taken some months to get around to this modification, Jay, but it works like a charm. Thanks again for your efforts.MonyMony wrote: ↑Sat Dec 07, 2019 3:05 pm I did this by going to the end of the partnerStationBlock.php code and making the following changes:
Original Code:Updated Code:Code: Select all
<script> $("#partnerStationSelector").change(function(){ id = $("#partnerStationSelector").val(); if(id != "all"){ $(".partnerStationClass").hide(); $("#partnerStation" + id).show(); } else{ $(".partnerStationClass").show(); } }) $("#partnerStationSelector").val(0); $("#partnerStation0").show(); </script>
Code: Select all
<script> $("#partnerStationSelector").change(function(){ id = $("#partnerStationSelector").val(); if(id != "all"){ $(".partnerStationClass").hide(); $("#partnerStation" + id).show(); } else{ $(".partnerStationClass").show(); } }) $("#partnerStationSelector").val('all'); $(".partnerStationClass").show(); </script>
The key points are to change the line $("#partnerStationSelector").val(0); to $("#partnerStationSelector").val(all); (This is the drop-down list entry) and to change the next line from $("#partnerStation0").show(); to $(".partnerStationClass").show();.
John
-
- Observer
- Posts: 41
- Joined: Sat Mar 23, 2019 2:03 pm
- Location: Covington, WA USA
- Station model: Davis Pro2
- Software: Meteobridge
- Contact:
Re: PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)
HI Jay,
Really like the modified radarUS block!! I think I made all the proper changes so it would display Geos 17 PNW satellite image/data.
I tried to modify the WU radar image so it would display the Seattle area rather than Dover. Can't seem to find the correct syntax. Need some help please.
How do you get the drop down menu to display "Visible Satellite-Pacific NW" since this is the default image?
When you have time.
Thanks
Paul
Really like the modified radarUS block!! I think I made all the proper changes so it would display Geos 17 PNW satellite image/data.
I tried to modify the WU radar image so it would display the Seattle area rather than Dover. Can't seem to find the correct syntax. Need some help please.
How do you get the drop down menu to display "Visible Satellite-Pacific NW" since this is the default image?
When you have time.
Thanks
Paul
- MonyMony
- Forecaster
- Posts: 180
- Joined: Sun Aug 20, 2017 12:54 pm
- Location: Elkton, Maryland, US
- Station model: Davis Pro 2
- Software: WeatherCat/Meteobridge
- Contact:
Re: PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)
Hi Paul,
When I can I will look at this. Crazy times with cancelling work trips due to CoVID-19 and dealing with the ramifications.
Jay
-
- Advisor
- Posts: 60
- Joined: Sun Dec 24, 2017 2:22 pm
- Station model: AW WS-2000ish
- Software: Meteobridge/OIP/GW-1000
- Contact:
Re: PartnerStation Block - Fixes for WU API Changes
Thanks Jay, I will take a look at this and get it implemented on my site soon.
Re: PartnerStation Block - Fixes for WU API Changes (and radarUSBlock modification too)
Here is a little different look for Partner stations you might like!
https://www.mpgj.com/template/indexDesktop.php
https://www.mpgj.com/template/indexDesktop.php