WU-radar-inc.php V1.10 now available for Wunderground website changes

Sorry it’s taken me a while longer than I expected to work out the changes needed … there hasn’t been a major change to this script since Version 1.09 - 06-Dec-2013 (when the current instance of their website came online). 3yrs2mos is not a bad run for a script :slight_smile:

Version 1.10 has some major changes in it:

  1. all the WU URLs are now HTTPS so you can keep your green padlock if your site is SSL/HTTPS
  2. some maps are no longer being updated by WU so Air Quality, IR Satellite, Humidity, Snow Depth and Visibility links have been dropped from the ‘below the map’ links area.
  3. The Jet Stream map (no longer available) has been replaced with a 24hr Precip map
  4. many of the new maps are using a different map projection than the prior map, so two new variables have been added
    $CityPos10
    $CityColor10
    to support placement on the new map projections.
  5. all the WU map URLs now go to icons.wunderground.com instead of maps.wunderground.com
  6. the setup screen has been modified and enhanced to have a button to copy the $CityPosN code to the clipboard for easy pasting into the WU-radar-inc.php settings area.

  1. For Saratoga template users, I’ve added the ability to have ALL the script settings be placed in Settings.php (after you’ve done a full configuration). That way, in the future, you can easily just replace the WU-radar-inc.php script and not have to reconfigure it. Bonus!
    I’ve added a panel after the other maps links area that displays (if a Saratoga template is detected) the following:

For existing users of the script, the easiest update is likely:

  1. rename a local copy of WU-radar-inc.php to WU-radar-inc-orig.php
  2. Download the updated script:
    Standalone: Download from the script page
    Saratoga template: use the update tool with a query of Base-USA, Plugin-*, 14-Feb-2017
  3. edit WU-radar-inc.orig.php and copy
// settings ----------------------------- */
$imagesDir = './ajax-images/';  // directory for ajax-images+radar buttons with trailing slash
$RDR  = 'MUX';  // last 3 characters of NOAA Radar Site Name
$Lat  = '37.27153397';    //North=positive, South=negative decimal degrees
$Long = '-122.02274323';  //East=positive, West=negative decimal degrees
$City = 'Saratoga';  // Name of city
$WUregion = 'sw';    // WeatherUnderground regional map group name
// 'sw'=SouthWest, 'nw'=NorthWest, 'mw'=Midwest
// 'sp'=South Central, 'ne'=North East, 'se'=South East
$WUname1	= 'City Level';		// tooltip label for mode=1
$WUname2	= 'South SF Bay';	// tooltip label for mode=2
$WUname3	= 'SF Bay Area';	// tooltip label for mode=3
$WUname4	= 'Southwest US';	// tooltip label for mode=4
$WUname5	= 'Entire US';		// tooltip label for mode=5

from old to new script.
Then copy your

// $CityPos1 - for City Level radar/animation
$CityPos1  =  'left: 389px; top: -254px;';
$CityColor1 = '#FFFFFF';  // color of legend display
// see instructions above to set  $CityURL value
$CityURL = 'https://radblast.wunderground.com/cgi-bin/radar/WUNIDS_map?station=MUX&brand=wui&num=1&delay=15&type=N0R&frame=0&scale=0.125&noclutter=0&t=1199816619&lat=37.27153397&lon=-122.02274323&label=Saratoga%2C+CA&showstorms=0&map.x=400&map.y=240&centerx=478&centery=335&transx=78&transy=95&showlabels=1&severe=0&rainsnow=0&lightning=0';

// $CityPos2 - for Metro Level radar/animation	 
$CityPos2  =  'left: 394px; top: -260px;';
$CityColor2 = '#FFFFFF';  // color of legend display
// see instructions above to set  $MetroURL value
$MetroURL = 'https://radblast.wunderground.com/cgi-bin/radar/WUNIDS_map?station=MUX&brand=wui&num=1&delay=15&type=N0R&frame=0&scale=0.272&noclutter=0&t=1199816502&lat=37.27153397&lon=-122.02274323&label=Saratoga%2C+CA&showstorms=0&map.x=400&map.y=240&centerx=436&centery=276&transx=36&transy=36&showlabels=1&severe=0&rainsnow=0&lightning=0';


// $CityPos3 - for unzoomed radar/animation
$CityPos3  =  'left: 386px; top: -262px;';
$CityColor3 = '#FFFFFF';  // color of legend display

// $CityPos4 - for US Advisory map
$CityPos4  =  'left: 35px; top: -324px;';
$CityColor4 = '#FFFFFF';  // color of legend display

// $CityPos5 = USA Radar/animation	 
$CityPos5  =  'left: 45px; top: -277px;';
$CityColor5 = '#FFFFFF';  // color of legend display

// $CityPos6 - for USA Radar Map
$CityPos6  =  'left: 73px; top: -220px;';
$CityColor6 = '#FFFFFF';  // color of legend display

// $CityPos7 - Regional maps (Fronts, Satellite, Wind, Jet Stream, Snow Depth, etc)
$CityPos7  =  'left: 51px; top: -345px;';
$CityColor7 = '#FFFFFF';  // color of legend display

// $CityPos8 - for USA Flu map
$CityPos8  =  'left: 34px; top: -318px;';
$CityColor8 = '#0000FF';  // color of legend display

// $CityPos9 - for Regional Advisories map
$CityPos9  =  'left: 49px; top: -326px;';
$CityColor9 = '#FFFFFF';  // color of legend display

from old to new script. Don’t overwrite the $CityPos10 and $CityColor10 lines!

  1. save the new WU-radar-inc.php and upload to your site.

  2. run WU-radar-testpage.php?show=loc on your site.

  3. click on the $CityPos10 link and click the cross-hair cursor on your city’s location on the map.

  4. Click on ‘Copy to Clipboard’, and paste over $CityPos10 line in WU-radar-inc.php, then save and upload the script… you’re done.

If you have a Saratoga template, then you can (after uploading that $CityPos10 change), reload in your browser the WU-radar-testpage.php?show=loc to see the Settings.php entries at the bottom of the page.
Click on the “Copy Settings.php entries to Clipboard” button, then you can paste the entries in your Settings.php to replace

// Radar settings
$SITE['noaaradar']		= 'MUX';   		// LAST 3 characters of NOAA Radar Site ID
										// e.g. Radar KMUX has $SITE['noaaradar'] = 'MUX';
$SITE['WUregion']	= 'sw';				// Wunderground regional maps
// 'sw'=SouthWest, 'nw'=NorthWest, 'mw'=Midwest
// 'sp'=South Central, 'ne'=North East, 'se'=South East


and then upload the changed Settings.php to your site.
Then you can replace the WU-radar-inc.php with uncustomized versions as they are released and still have your site settings honored.

Enjoy!

Best regards,
Ken

Thanks for the update, Ken. :slight_smile: Superb job, as usual. Your instructions above are spot on and invaluable. =D> :D/ =D>

Hi Ken… I’m now getting this error on my radar test page…


Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /homepages/8/d252567151/htdocs/WU-radar-testpage.php:11) in /homepages/8/d252567151/htdocs/include-style-switcher.php on line 31

Warning: Cannot modify header information - headers already sent by (output started at /homepages/8/d252567151/htdocs/WU-radar-testpage.php:11) in /homepages/8/d252567151/htdocs/include-style-switcher.php on line 350

Warning: Cannot modify header information - headers already sent by (output started at /homepages/8/d252567151/htdocs/WU-radar-testpage.php:11) in /homepages/8/d252567151/htdocs/include-style-switcher.php on line 350
   


And, My location is so far off on some of the maps that I cant scroll far enough to set the correct location.

Hmmm… you’re the second to report this issue with warnings regarding include-style-switcher (and I’ve not found the root cause yet).

Try this bypass:

  1. make sure you’re using V1.11 (released today) of WU-radar-inc.php
  2. change the code in WU-radar-inc.php to disable the include of Settings.php temporarily by changing
if($doSWXTemplate) {
	include_once("Settings.php");
	print "<!-- Settings.php found and included any override settings -->\n";
}

to

if($doSWXTemplate) {
//	include_once("Settings.php");
//	print "<!-- Settings.php found and included any override settings -->\n";
}

  1. do the original->new conversion in the first post steps (3) thru (7).

Then undo the above mod to WU-radar-inc.php and you can use the Settings.php copy.

OK… Made the changes, but for citypos 1 and 2 its so far off that I cant put my position in the right location cause its off the screen.

I did do an oops in this process. I didn’t save my old settings… #-o

You can go back to the NEXRAD screen on Wunderground here and do the setup for the Metro and City areas again, then they should show correctly in the map. See http://saratoga-weather.org/scripts-WUradar.php#WUradar for details.

Thanks Ken… I’ll check that out.

Mark,
Try using this

<?php
global $SITE;
$doSWXTemplate = (file_exists("Settings.php") and 
                  file_exists("include-style-switcher.php") and 
				  file_exists("common.php"))?true:false;
if($doSWXTemplate) {
	include_once("Settings.php");
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>WU-radar testpage</title>
</head>

<body style="font-family:Arial, Helvetica, sans-serif;color: #0000FF;background-color: #FFFFCC">
<p>Test page for WU-radar-inc.php.  Use <a href="?show=loc"><strong>this link</strong></a> to start script with location setting aid enabled.</p>
<div style="width: 640px;background-color: #000000;color:#FFFFFF; font-size: 14px">
<?php include("WU-radar-inc.php"); ?>
</div>
</body>
</html>

for WU-radar-testpage.php and see if that fixes the Warning: issue.

Did a quick test of this code Ken and no errors and I was able to position my location on the map for all cities.

I don’t know why, but Im having a hard time trying to get these settings to stick on the map. It keeps putting my in Canada or out in the pacific ocean after I make the changes.

http://www.northbendweather.com/wxradar.php

Here’s something that Ken told me and that I wasn’t aware of:

When you're clicking on the map to set a position, make sure the map page TOP is fully visible.. if you click while scrolled down a bit, you'll get incorrect cursor readings.

Might be why your position on the map is wrong…

Thanks Dan. Ill post a screen shot of what I’m seeing after work to show you what my issues are.

WU has replaced some of the maps with an “Image is no longer available” image. Don’t know if it’s transient or permanent. Likely another release of WU-radar-inc.php will be done this afternoon.

Mark,
On your site, the WU-radar-testpage.php?show=loc is producing fractions in the $CityPosN entries like

$CityPos3 = ‘left: 450.79998779296875px; top: -172px;’;

when they should show up as

$CityPos3 = ‘left: 451px; top: -172px;’;

I’m not seeing the same effect (with the same browser and script on my site) #-o

What Dan said is also correct… you need to have the browser page at the top of the scroll before you try clicking on the position for the red-dot, otherwise the JavaScript can’t determine the offset values to use (due to the page not being at the top).

Do that by clicking on the $CityPosN link first and the page will automatically scroll to the proper position (with the top aligned with the black selection area for the radar/map screen).

Here’s an updated WU-radar-testpage.php that will hopefully ensure the positioning of the page is correct.

<?php
global $SITE;
$doSWXTemplate = (file_exists("Settings.php") and 
                  file_exists("include-style-switcher.php") and 
				  file_exists("common.php"))?true:false;
if($doSWXTemplate) {
	include_once("Settings.php");
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>WU-radar testpage</title>
</head>

<body style="font-family:Arial, Helvetica, sans-serif;color: #0000FF;background-color: #FFFFCC">
<?php if(!isset($_REQUEST['show'])) { ?>
<p>Test page for WU-radar-inc.php.  Use <a href="?show=loc#WUtop"><strong>this link</strong></a> to start script with location setting aid enabled.</p>
<?php } /* end Show the reminder */ ?>
<div style="width: 640px;background-color: #000000;color:#FFFFFF; font-size: 14px">
<?php include("WU-radar-inc.php"); ?>
</div>
</body>
</html>

For some reason when i click on the position i want, it gives me that long fractions. Ill try again after work today.

Try the attached version of WU-radar-inc.php – it has forcing for integers on the JavaScript. Also a fix for the Flu image.

The regional Front radar images are not available on the WU site (only the USA images), so we’ll have to wait for them to fix that.


WU-radar-inc.php.txt (76.7 KB)

Hi Ken, I loaded the file that you have posted. Everything from citypos3 on works fine, but still cant set citypos 1 and 2 cause its too far away for me to set the correct position. I’ve attached a screen shot so you can see what I’m seeing.

Thanks


Mark,

Try changing the $MetroURL and $CityURL from current


$SITE['CityURL'] = 'https://radblast.wunderground.com/cgi-bin/radar/WUNIDS_map?station=ATX&brand=wui&num=1&delay=15&type=N0R&frame=0&scale=0.125&noclutter=0&t=1199816619&lat=47.4992&lon=-121.7778&label=Saratoga%2C+CA&showstorms=0&map.x=400&map.y=240

Thanks Ken. That did it. Im wondering why my area had this big of a issue. The last updated awhile back was simple, but this one seemed a lot different.

Thanks again for your help.