They're free, but use at your own risk
The scripts referenced here are used in the operation of this weather station, and may be freely copied and used to support your station. Please note that you use these scripts at your own risk. No warranty is expressed or implied. I accept no liability for any damages that may ensue from their use.
You will need to configure them for your own particular weather station website.
A RSS Feed is available to help keep you informed on updates to the scripts.
A Version History is available -- check back from time to time to see if there are updates to scripts you have downloaded earlier.
Announcements of version updates and new scripts are made on
and saratogaWXPHP Twitter account as they become available.
This page was updated
Sunday, 02-Sep-2012 1:16 PM
Carterlake-style Wunderground USA Radar/Maps PHP
Thanks to Tom at Carter Lake, many folks have downloaded and adapted his Weather Underground Radar/Maps display. The script produces a great display of current radar and maps, but has required fairly expert HTML coding to adapt to your own website. Thanks to additions and modifications made by Jim at Juneau County Weather, new maps and highlighting features were added. This script builds on the work of both Tom and Jim to (hopefully) provide a comprehensive AND easy-to-configure PHP script to display the great radar and maps available on Weather Underground.
PLEASE NOTE: This script only works for locations in the continental US (lower 48 states).
Legal Stuff -- please read and heed...
In a series of mail messages and forum postings, the intent of WU is to allow fair usage of their graphics and data for personal, non-commercial stations that contribute data to WeatherUnderground was stated. Here's the message with that information:
My name is John Celenza and I am the Director of Weather Technology at Wunderground.
Please let me explain.
It is not Weather Underground's intention to disallow folks to use our graphics and data on their personal/non-commercial web sites.
Please feel free to use Wunderground images and data on personal sites, as long as you link those images to Wunderground or give direct credit. Something like "This image courtesy of Weather Underground" is appropriate.
We sincerely appreciate the contributions folks have made to our community. And, we are in no way an organization trying to take...take...take and not give. Our philosophy couldn't be farther from that.
Hopefully we can make the Terms of Service more clear soon.
So, in order to use this script you need to:
- Have your weather station submit data to WeatherUnderground as a WU member.
- Use this script ONLY on your personal, non-commercial weather station website.
- Leave attribution (and hotlink) to WeatherUnderground as the source of the data.
Adhere to these three requirements, and you should have fair use of this data from Weather Underground.
Show Normal View | Show with Configuration Aid enabled
Settings in the WU-radar-inc.php script
// 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
- This setting controls the directory location of the helper images used by the script. Default is ./ajax-images/.
- This is the last three characters of your selected NEXRAD Radar Site ID. My radar is KMUX, so the default shown above is MUX.
- This is the latitude and longitude of your weather station in decimal degrees.
- This is the name of your City or Weather Station. It will appear overlaid on the maps as shown here.
- This is the 2-character identifier for the 'region' of the USA your site is in. The six allowed values are shown in the comments above. All regional maps will use this as part of the image URL to Wunderground.
- $WUname1 ... $WUname5
- These variables specify the text to display as the mouse cursor is rolled across the zoom buttons at the top, left of the display. You should change $WUname2 ... $WUname4 to reflect the locale of your weather station.
The $CityURL and $MetroURL settings in the script control the pan/zoom for the local radar display (mode=1, mode=2) and need to be set up like this:
- Go to www.wunderground.com and search for your city, state, then click on the Nexrad side of the radar image which will open a new map page.
- Draw a box around your 'metro area' .. the radar image on Wunderground will zoom in.
- Right click on 'View/Save this image' and copy URL to clipboard
- Paste the url from the clipboard into the $MetroURL = '...'; setting.
- draw a box on the Wunderground radar around your 'city area'
- right click on 'View/Save this image' and copy URL to clipboard
- paste the URL from the clipboard into the $CityURL = '...'; setting
The final part of the setup is to discover and store the relative position information
for the red dot (•) to mark your City location over each
map type. The $CityPosN variables are used to store the relative position information to
place a red dot and $City over the map displayed. There are 9 different sizes
of maps displayed. The $CityColorN variables are for the text color of the
overlay city name display. '#FFFFFF' (white) should work for most displays,
You may need to adjust $CityColor4 (advisory map) and/or $CityColor8 (Flu map)
to a different color since they use white backgrounds.
Now run the WU-radar-testpage.php?show=loc on your website to enable the helper app.
There are currently 9 different map topologies used in the display, so you'll need to repeat this process 9 times:
- Click on the $CityPos1 link shown on the page, then
- click the cross-hair cursor over the point where the red dot is to appear, and
the legend will move to that location, and the PHP code will appear in a text box
for copying new values.
Highlight the text box on the page displaying
$CityPos1 = 'left: nnnpx; top: -mmmpx';
- copy the contents to the clipboard, and paste it to replace the $CityPos1 line
shown in the script.
Repeat the procedure for $CityPos2 through $CityPos9. Change the corresponding $CityColorN if need be to allow your city location to display over the map.
Now your copy of the script should be fully configured. Upload your changed copy of the script. It's now ready to include in your own webpage by using this code:
where you'd like the display to be placed.
Installation of WU-radar-inc.php
Download WU-radar.zip from the link below.
Unzip the file and upload the contents to your website. The helper graphics will be placed in ./ajax-images/ directory .
Change settings in WU-radar-inc.php as instructed in the settings area above.
Download: WU-radar-inc.php distribution (Version 1.08 - 02-Aug-2012)
Download: just the WU-radar-inc.php script.
Using this script on your website
Because of differences in rendering engines used in different browsers, you may find misplaced red-dot/city name overlays if you attempt to center the display on a page in your website. It may look fine in Firefox, but break terribly in Internet Explorer.
I recommend you NOT use <center></center>, <div align="center"></div>, trying to 'float' the display, or use it inside a table. None seem to satisfy IE. Using the code:
<?php include("WU-radar-inc.php"); ?>
seems to work the best for Firefox, IE, Opera and Safari-Win. If you really want to center the script, then Jim (Juneau County Weather) suggests using an <iframe> like this:
<iframe src="http://your.website.com/WU-radar-inc.php" width="660" height="740"
style="background-color:#000000; color:#FFFFFF; font-family:Arial, Helvetica, sans-serif;"