Author Topic: ec-radar.php script dead due to Environment Canada website changes  (Read 2084 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
It looks like Environment Canada has change the radar presentation to use a map-based version, and is no longer generating the images needed by the ec-radar.php script for operation.

I've started working on a replacement script, but for now, the old script is dead :(

 
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #1 on: April 14, 2021, 02:12:48 PM »
Replacement scripts DONE!

I've shamelessly stolen the HAniS animation script set from Jerry Wilkins (thanks Jerry!) and with a tip from a Twitter follower, located a new set of Environment Canada radar .gif images that are being updated.

Use the update tool for Base-Canada, Plugin-*, 14-Apr-2021 to get the script set.

Note:  you'll need to do changes to index.php (but an updated wxindex.php is included).  Here's the 'README-wxecradar.txt' contents:

Quote
This is the README file for wxecradar scripts (Environment Canada Radar display using HAniS).

As of 30-Mar-2021, Environment Canada changed their Radar website to use a map to display radar information, and
stopped publishing radar images as .gif files on their main website.  This rendered the former display script
of ec-radar.php obsolete and non-functional (since the images were no longer available).

Fortunately, the radar .gif images continue to be published on https://dd.weather.gc.ca/radar/PRECIPET/GIF/{sitename}/
BUT sadly, they no longer have the detail overlays of towns, highways, rivers on the new maps. So, the new .gif
radar images are a bit sparse but do otherwise display the 14-color versions of the original .gif images.

Contents:
  wxradar.php       (the linked-to script from the menu for radar display in Base-Canada template)
  wxecradar-inc.php (provides selection capability and <iframe> for HAniS display)
  wxecradar-iframe.php (provides contents to display in the <iframe>)
  wxecradar-list-inc.php  (list of current radar stations for display)
  hanis_min.js      (the HAniS script)
  wxindex.php       (updated to use wxecradar-iframe.php to display a radar image set)

All the files should be in the same directory (normally, the document root of the website).

If manually converting from an older wxindex.php to the new one, just replace:

------
         <?php
         // fetch fresh national radar image if needed .. you can chang it to
         // 'NAT' = National radar view
         // 'PAC' = Pacific region
         // 'WRN' = Praries region
         // 'ONT' = Ontario
         // 'QUE' = Quebec
         // 'ERN' = Atlantic region
           $_REQUEST['site'] = 'NAT'; // one of the sites above, or your radar designator
           $doPrint = false;
           include_once("ec-radar.php");
         ?>
         <img src="<?php echo $radarDir . 'radar-' . $_REQUEST['site'] . '-0.png'; ?>"
         alt="Radar, courtesy of Environment Canada"
         title="Radar, courtesy of Environment Canada" />
------

with

------
         <?php
         // fetch national radar image if needed
         // 'PYR' = Pacific region
         // 'PNR' = Praries region
         // 'ONT' = Ontario
         // 'QUE' = Quebec
         // 'ATL' = Atlantic region
         // or use the local radar site code like WKR or CASET .. see wxecradar-list-inc.php for codes

           $radarLoc = 'ONT';
            
         //  $radarLoc = $SITE['ecradar']; // use Settings.php entry   
            $radar='RAIN'; // ='RAIN' or ='SNOW';
         ?>
<iframe name="wxradarshanis" width="617" height="<?php echo (in_array($radarLoc,array('PYR','PNR','ONT','QUE','ATL')))?'380':'555';?>" src="./wxecradar-iframe.php?radar=<?php echo $radar?>&amp;radarLoc=<?php echo $radarLoc?>&amp;lang=<?php echo $SITE['lang']; ?>" scrolling="no" style="border:none"></iframe>
------

Your Settings.php entry of:

  $SITE['ecradar'] = 'WKR';

will determine the selected site in wxradar.php display

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

See the running version at Saratoga Base-Canada Demo.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline blainec

  • Senior Member
  • **
  • Posts: 70
    • Weather YYC
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #2 on: April 17, 2021, 04:27:51 PM »
Mine doesn't seem to work. Did I do something wrong

https://weatheryyc.ca

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #3 on: April 17, 2021, 05:24:56 PM »
Looks like you're just missing hanis_min.js   (File not installed) to have it work.  The $SITE['ecradar'] = 'CASSM'; in Settings.php looks ok.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #4 on: April 17, 2021, 07:05:00 PM »
Sorry, my bad.  I forgot to 'touch' hanis_min.js for a 2021-04-14 release date so the updates.php script would include it .

Do the update tool again with query 14-Apr-2021, Base-Canada, *-plugin and the hanis_min.js will be included.

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Online PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #5 on: April 18, 2021, 12:32:04 PM »

Hi Ken,
I have updated the files but the radar image is not showing.
My index.php is a bit modified but I have copied in the block as per Readme wxecradar http://komokaweather.com/komokaweather-ca/index.php
Also updated with new wxindex.php (not modified) and that is the same http://komokaweather.com/komokaweather-ca/wxindex.php


I haven't been able to find the cuse.  Any suggestion where to look?


Enjoy,
Paul

Offline blainec

  • Senior Member
  • **
  • Posts: 70
    • Weather YYC
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #6 on: April 18, 2021, 12:44:44 PM »

Hi Ken,
I have updated the files but the radar image is not showing.
My index.php is a bit modified but I have copied in the block as per Readme wxecradar http://komokaweather.com/komokaweather-ca/index.php
Also updated with new wxindex.php (not modified) and that is the same http://komokaweather.com/komokaweather-ca/wxindex.php


I haven't been able to find the cuse.  Any suggestion where to look?


Enjoy,
Paul
I had the same problem yesterday. It turned out that a file needed was not included in the update. (hanis_min.js)
I have attached the file incase this is the problem you are having.

Online PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #7 on: April 18, 2021, 02:17:26 PM »
Hi Blair, and thanks for responding.  Your radar page looks good.
I did notice your post exchange with Ken and made sure the download zip contained the hanis_min.js file.

Looks like mine is a different issue, or mistake on my part.


Enjoy,
Paul

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #8 on: April 18, 2021, 02:19:19 PM »
Paul, it looks like your webserver is not getting the list of available files from the EC site.  I've added some diagnostics to wxecradar-iframe.php (V1.01) to show what might be happening.  Upload the (unzipped) version to your site(s) and let me know.. that should provide a clue about what might be the matter.

Ed. note: updated v1.01 to release version
« Last Edit: April 19, 2021, 01:20:54 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Online PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #9 on: April 18, 2021, 02:38:38 PM »
Thanks Ken,
I have replaced the wxecradar-iframe.php


Regards,
Paul

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #10 on: April 18, 2021, 02:43:35 PM »
Ummm... I don't see the update at view-source:http://komokaweather.com/komokaweather-ca/wxecradar-iframe.php?radar=RAIN&radarLoc=ONT&lang=en .. it still shows V1.00 for wxecradar-iframe.php
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Online PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #11 on: April 18, 2021, 03:01:51 PM »
Hi Ken,
I had updated it.  Also through FileZilla I did a View/Edit of the file on webserver and it has
Code: [Select]
# using HAniS JavaScript display animation
#
# Version 1.00 - 14-Apr-2021 - initial release
# Version 1.01 - 18-Apr-2021 - added diagnostic output re curl fetch results
############################################################################
$Version = 'wxecradar-iframe.php V1.01 - 18-Apr-2021';
Thanks,
Paul

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #12 on: April 18, 2021, 03:42:29 PM »
Ahh, but your webserver is still serving up wxecradar-iframe.php V1.00 - 14-Apr-2021 using the view-source.  It looks like your site is using Securi/CloudProxy, so it's serving up the old script.  Use your control panel for the website to refresh the proxy, and the new script will likely show up.

Code: [Select]
GET http://komokaweather.com/komokaweather-ca/wxecradar-iframe.php?radar=RAIN&radarLoc=ONT&lang=en
    HTTP/1.1 200 OK
    Server: Sucuri/Cloudproxy
    Date: Sun, 18 Apr 2021 19:37:09 GMT
    Content-Type: text/html; charset=UTF-8
    Content-Length: 881
    Connection: keep-alive
    X-Sucuri-ID: 11020
    X-XSS-Protection: 1; mode=block
    X-Frame-Options: SAMEORIGIN
    X-Content-Type-Options: nosniff
    Vary: Accept-Encoding,User-Agent
    Content-Encoding: gzip
    X-Sucuri-Cache: HIT
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #13 on: April 18, 2021, 03:50:28 PM »
Now the website cache has refreshed.  The issue is:

Quote
<!-- curl fetching 'https://dd.weather.gc.ca/radar/PRECIPET/GIF/ONT/' -->
<!-- curl Error: Connection timed out after 5000 milliseconds -->
<!-- HTTP stats:  RC=0 dest= port=0 (from sce=)
      Times: dns=0.004 conn=0.000 pxfer=0.000 get=5.001 total=5.001 secs -->
<!-- theData returns 0 bytes -->
curl is timing out trying to connect to dd.weather.gc.ca .. that's the problem.  Why it's happening is something for your website hoster tech support to address.

On my site, a 'good' fetch shows
Quote
<!-- curl fetching 'https://dd.weather.gc.ca/radar/PRECIPET/GIF/ONT/' -->
<!-- HTTP stats:  RC=200 dest=205.189.10.47 port=443 (from sce=74.208.252.86)
      Times: dns=0.028 conn=0.064 pxfer=0.988 get=0.198 total=1.186 secs -->
<!-- theData returns 187712 bytes -->
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #14 on: April 18, 2021, 04:06:17 PM »
I suggest you turn off the Securi caching of your website.  Now the view-source of the page returns in 300ms, so it can't be executing the code .. it's just returning the HTML of the failed access.

BTW.. caching for anything but images is not a good idea for a weather website which has content that changes much faster than the usual cache time.  At least, turn off caching for .php and .txt (latter for the realtime files), so your site will work with real-time data.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Online PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #15 on: April 18, 2021, 04:54:50 PM »

Hi Ken, and thanks for identifying the issue.  I will contact GoDaddy again.  The last time they weren't really helpful but it did improve some other cache issue I was having at the time.


Regards,
Paul

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4107
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #16 on: April 19, 2021, 09:24:14 AM »
I am in the USA, but close enough to Canada that I like to have the Environment Canada radar site on my website.

I pulled the relevant updated files, but I had a little difficulty with the default radar site. It seemed to ignore my settings.php.

I ended up changing the site in the wxecradar-inc.php (include file) to change it from the Toronto radar site to the one north of Sault Ste. Marie, Canada as follows:

Code: [Select]
$radarLoc = 'CASMR'; // IMPORTAMT!!! Default radar location is set here
Greg H.


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Online PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #17 on: April 19, 2021, 09:31:44 AM »
Looks good Greg.


I hadn't done anything further with GoDaddy on my account yet but the radar images began to appear last night, so it is working as expected.  Thanks again Ken.


Enjoy,
Paul

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 724
    • Lake Huron Weather
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #18 on: April 19, 2021, 09:37:58 AM »
I am in the USA, but close enough to Canada that I like to have the Environment Canada radar site on my website.

I pulled the relevant updated files, but I had a little difficulty with the default radar site. It seemed to ignore my settings.php.

I ended up changing the site in the wxecradar-inc.php (include file) to change it from the Toronto radar site to the one north of Sault Ste. Marie, Canada as follows:

Code: [Select]
$radarLoc = 'CASMR'; // IMPORTAMT!!! Default radar location is set here
Greg H.

For the same reasons I did the same thing Greg  :grin:
https://lakehuronweather.org/wxRadarECON.php

Nice job Ken and as always, thanks a lot!

CW3699

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #19 on: April 19, 2021, 11:20:04 AM »
I am in the USA, but close enough to Canada that I like to have the Environment Canada radar site on my website.

I pulled the relevant updated files, but I had a little difficulty with the default radar site. It seemed to ignore my settings.php.

I ended up changing the site in the wxecradar-inc.php (include file) to change it from the Toronto radar site to the one north of Sault Ste. Marie, Canada as follows:

Code: [Select]
$radarLoc = 'CASMR'; // IMPORTAMT!!! Default radar location is set here
Greg H.
Hmmm.. did you insert in Settings.php
Code: [Select]
$SITE['ecradar'] = 'CASMR'; That should work to specify the default EC radar site to display.

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4107
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #20 on: April 19, 2021, 05:37:23 PM »
I believe that I tried it, but I kept getting the Toronto radar site.

Greg H.


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline Total

  • Web dude ..
  • Senior Contributor
  • ****
  • Posts: 151
    • weather station ..
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #21 on: July 11, 2021, 11:55:29 PM »
Hello : Is there anyway to get rid of the UTC time and use local time ? Thanks

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #22 on: July 12, 2021, 10:51:16 AM »
The UTC time display is embedded in the .gif image from the EC, so no display in local time is available.  Sorry...
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Total

  • Web dude ..
  • Senior Contributor
  • ****
  • Posts: 151
    • weather station ..
Re: ec-radar.php script dead due to Environment Canada website changes
« Reply #23 on: July 12, 2021, 03:34:59 PM »
thanks , it is a great add on for my site .