The announced changover date for forecast.weather.gov is still 7-Mar-2017 and it has a lot of changes. The forecast-v3.weather.gov site (preview NWS site) shows what the new site will look like.
For we who operate personal weather websites that use my advforecast2.php script, be aware that the coming changes will make V4.x of the script NO LONGER WORK as they have removed the /MapClick.php?... functionality of the forecast.weather.gov website in favor of a new request mechanism.
I've put together advforecast2.php V5.00 as a fairly complete rewrite of the prior script. It now uses the api.weather.gov website to retrieve JSON data for point-forecasts, zone forecasts and the needed metadata about both.
I'm not going to release the update via my usual channels (script page and Saratoga template Updates tool) until AFTER their cutover is done, but... you can make your USA website ready by installing the contents of the attached zip file.
Here's the README file included with the .zip file that helps explain what's changed:
This is the updated support package for version of advforecast2.php V5.00 - 06-Mar-2017
The advforecast2.php V5.00 uses the new NWS api.forecast.gov to retrieve JSON data and construct the forecast
display, so it differs from all prior versions (which used page scraping of the point-printable
forecast).
Since the new forecast.weather.gov website uses a different method to specify the point forecast,
the script includes auto-conversion of old-format point-printable forecast URLs to the new
format required.
As of 6-Mar-2017, the api.weather.gov alerts query returns only alerts of types:
Advisory, Watch, Warning and Statement.
The Outlook type alert is NOT currently included in the feed.
That may change in the future, but be aware that "Hazardous Weather Outlook" will not be displayed.
New with this release:
Improved diagnostics (available with ?debug=y on the URL) as HTML comments on the page
Improved cURL-based fetch for all data from api.weather.gov
cache files for the script have new (but related) names:
./cache/forecast-{Zone}-{n}-json.txt contains the forecast data for the point or Zone
./cache/forecast-{Zone}-{n}-json-alerts.txt contains the alert data for the Zone
./cache/forecast-{Zone}-{n}-json-meta.txt contains the metadata about the point, Zone and WFO
New icon template file:
./forecast/icon-templates/nsmoke.png (nighttime smoke image)
New icons with PoP stamps:
./forecast/images/cold[0..100].[jpg|png] daytime cold w/PoP stamps
./forecast/images/ncold[0..100].[jpg|png] nighttime cold w/PoP stamps
DualImage.php V1.01 - 06-Mar-2017 supports the modified/new icon names from the NWS
advforecast2.php V5.00 - 06-Mar-2017 has additional new features:
setting addition:
$showTwoIconRows = true; // =true; show all icons, =false; show 9 icons in one row (new V5.00)
If =true;, then two rows of up-to 9 columns of icons for day and night icons are shown
If =false;, then the original style of one row of 9 icons are shown.
running advforecast2.php?convert will display the the converted new-format point forecast URLs and
other settings needed. If run on a site with a Saratoga template, the $SITE[] settings for Settings.php
will display, otherwise, the internal settings needed for advforecast2.php itself will be displayed.
Samples:
----------original settings----------
$NWSforecasts = array(
// the entries below are for testing use.. replace them with your own entries if using the script
// outside the AJAX/PHP templates.
// ZONE|Location|point-forecast-URL (separated by | characters
"CAZ513|Saratoga, CA (WRH)|http://forecast.weather.gov/MapClick.php?CityName=Saratoga&state=CA&site=MTR&textField1=37.2639&textField2=-122.022&e=1&TextType=2",
"NEZ052|Omaha, NE (CRH)|http://forecast.weather.gov/MapClick.php?lat=41.2586&lon=-95.9378&unit=0&lg=english&FcstType=text&TextType=2",
"ALZ266|Gulf Shores, AL (SRH)|http://forecast.weather.gov/MapClick.php?CityName=Gulf+Shores&state=AL&site=MOB&textField1=30.27&textField2=-87.7015&e=0&TextType=2",
'MDZ022|Salisbury, MD (ERH)|http://forecast.weather.gov/MapClick.php?lat=38.36818&lon=-75.59761&unit=0&lg=english&FcstType=text&TextType=2',
'AKZ101|Anchorage, AK (ARH)|http://forecast.weather.gov/MapClick.php?lat=61.21806&lon=-149.90027780000003&unit=0&lg=english&FcstType=text&TextType=2',
'HIZ005|Honolulu, HI (HRH)|http://forecast.weather.gov/MapClick.php?lat=21.30694&lon=-157.85833330000003&unit=0&lg=english&FcstType=text&TextType=2',
'IAZ068|Riverdale, IA|http://forecast.weather.gov/MapClick.php?lat=41.5354&lon=-90.4671&unit=0&lg=english&FcstType=text&TextType=2',
'MEZ030|Bar Harbor, ME|http://forecast.weather.gov/MapClick.php?lat=44.76&lon=-67.5477&unit=0&lg=english&FcstType=text&TextType=2',
'TXZ147|Fairfield, TX|http://forecast.weather.gov/MapClick.php?&lat=31.7188&lon=-96.1655&lg=english&FcstType=text&TextType=2',
'SDZ021|Millbank, SD|http://forecast.weather.gov/MapClick.php?lat=45.194&lon=-96.6869&unit=0&lg=english&FcstType=text&TextType=2',
'MNZ034|Brainerd, MN|http://forecast.weather.gov/MapClick.php?lat=46.3544&lon=-94.1941&unit=0&lg=english&FcstType=text&TextType=2',
'COZ010|Vail, CO|http://forecast.weather.gov/MapClick.php?lat=39.5864&lon=-106.3822&unit=0&lg=english&FcstType=text&TextType=2',
'CAZ072|South Lake Tahoe, CA|http://forecast.weather.gov/MapClick.php?lat=38.93333&lon=-119.98333&unit=0&lg=english&FcstType=text&TextType=2',
'WAZ037|Colville, WA|http://forecast.weather.gov/MapClick.php?lat=48.5433&lon=-117.8951&unit=0&lg=english&FcstType=text&TextType=2',
'ILZ014|Hoffman Estates, IL|http://forecast.weather.gov/MapClick.php?lat=42.03921&lon=-88.11001&unit=0&lg=english&FcstType=text&TextType=2',
'NDZ027|Grand Forks, ND|http://forecast.weather.gov/MapClick.php?lat=47.9169&lon=-97.072&unit=0&lg=english&FcstType=text&TextType=2',
'MTZ055|Bozeman, MT|http://forecast.weather.gov/MapClick.php?lat=45.6354&lon=-111.0633&unit=0&lg=english&FcstType=text&TextType=2',
"AZZ023|Phoenix|http://forecast.weather.gov/MapClick.php?CityName=Phoenix&state=AZ&site=PSR&textField1=33.646&textField2=-112.007&e=0&TextType=2",
'KSZ078|Dodge City, KS|http://forecast.weather.gov/MapClick.php?lat=37.7528&lon=-100.0171&unit=0&lg=english&FcstType=text&TextType=2',
'OKZ020|Stillwater, OK|http://forecast.weather.gov/MapClick.php?lat=36.1156&lon=-97.0584&unit=0&lg=english&FcstType=text&TextType=2',
);
//*/
//*
//
$NOAAZone = 'CAZ513'; // change this line to your NOAA warning zone.
// set $fileName to the URL for the point-printable forecast for your area
// NOTE: this value (and $NOAAZone) will be overridden by the first entry in $NWSforecasts if it exists.
$fileName = "http://forecast.weather.gov/MapClick.php?CityName=Saratoga&state=CA&site=MTR&textField1=37.2639&textField2=-122.022&e=1&TextType=2";
//*/
$showTwoIconRows = true; // =true; show all icons, =false; show 9 icons in one row (new V5.00)
-------------------------------------
-----Converted settings for standalone ------
// advforecast2.php (JSON) - V5.00 - 06-Mar-2017
// settings converted to new point-forecast request URLs.
// Put these in advforecast2.php to update the settings there.
// -- start of converted settings for advforecast2.php JSON version.
$NWSforecasts = array(
// the entries below are for testing use.. replace them with your own entries if using the script
// outside the Saratoga AJAX/PHP templates.
// ZONE|Location|point-forecast-URL (separated by | characters
'CAZ513|Saratoga, CA (WRH)|https://forecast-v3.weather.gov/point/37.2639,-122.022',
'NEZ052|Omaha, NE (CRH)|https://forecast-v3.weather.gov/point/41.2586,-95.9378',
'ALZ266|Gulf Shores, AL (SRH)|https://forecast-v3.weather.gov/point/30.27,-87.7015',
'MDZ022|Salisbury, MD (ERH)|https://forecast-v3.weather.gov/point/38.3682,-75.5976',
'AKZ101|Anchorage, AK (ARH)|https://forecast-v3.weather.gov/point/61.2181,-149.9003',
'HIZ005|Honolulu, HI (HRH)|https://forecast-v3.weather.gov/point/21.3069,-157.8583',
'IAZ068|Riverdale, IA|https://forecast-v3.weather.gov/point/41.5354,-90.4671',
'MEZ030|Bar Harbor, ME|https://forecast-v3.weather.gov/point/44.76,-67.5477',
'TXZ147|Fairfield, TX|https://forecast-v3.weather.gov/point/31.7188,-96.1655',
'SDZ021|Millbank, SD|https://forecast-v3.weather.gov/point/45.194,-96.6869',
'MNZ034|Brainerd, MN|https://forecast-v3.weather.gov/point/46.3544,-94.1941',
'COZ010|Vail, CO|https://forecast-v3.weather.gov/point/39.5864,-106.3822',
'CAZ072|South Lake Tahoe, CA|https://forecast-v3.weather.gov/point/38.9333,-119.9833',
'WAZ037|Colville, WA|https://forecast-v3.weather.gov/point/48.5433,-117.8951',
'ILZ014|Hoffman Estates, IL|https://forecast-v3.weather.gov/point/42.0392,-88.11',
'NDZ027|Grand Forks, ND|https://forecast-v3.weather.gov/point/47.9169,-97.072',
'MTZ055|Bozeman, MT|https://forecast-v3.weather.gov/point/45.6354,-111.0633',
'AZZ023|Phoenix|https://forecast-v3.weather.gov/point/33.646,-112.007',
'KSZ078|Dodge City, KS|https://forecast-v3.weather.gov/point/37.7528,-100.0171',
'OKZ020|Stillwater, OK|https://forecast-v3.weather.gov/point/36.1156,-97.0584',
);
//
$NOAAZone = 'CAZ513'; // change this line to your NOAA warning zone.
//
// set $fileName to the URL for the point-printable forecast for your area
// NOTE: this value (and $NOAAZone) will be overridden by the first entry in $NWSforecasts if it exists.
//
$fileName = 'https://forecast-v3.weather.gov/point/37.2639,-122.022';
//
$showTwoIconRows = true; // =true; show all icons, =false; show 9 icons in one row (new V5.00)
//
// -- end of converted settings for advforecast2.php JSON version.
-------------------------------------
-----Converted settings for Saratoga template ------
// advforecast2.php (JSON) - V5.00 - 06-Mar-2017
// settings converted to new point-forecast request URLs.
// Put these in Settings.php to update the settings there.
// -- start of converted settings for advforecast2.php JSON version.
$SITE['NWSforecasts'] = array(
// the entries below are for testing use.. replace them with your own entries if using the script
// outside the Saratoga AJAX/PHP templates.
// ZONE|Location|point-forecast-URL (separated by | characters
'CAZ513|Saratoga, CA (WRH)|https://forecast-v3.weather.gov/point/37.2639,-122.022',
'NEZ052|Omaha, NE (CRH)|https://forecast-v3.weather.gov/point/41.2586,-95.9378',
'ALZ266|Gulf Shores, AL (SRH)|https://forecast-v3.weather.gov/point/30.27,-87.7015',
'MDZ022|Salisbury, MD (ERH)|https://forecast-v3.weather.gov/point/38.3682,-75.5976',
'AKZ101|Anchorage, AK (ARH)|https://forecast-v3.weather.gov/point/61.2181,-149.9003',
'HIZ005|Honolulu, HI (HRH)|https://forecast-v3.weather.gov/point/21.3069,-157.8583',
'IAZ068|Riverdale, IA|https://forecast-v3.weather.gov/point/41.5354,-90.4671',
'MEZ030|Bar Harbor, ME|https://forecast-v3.weather.gov/point/44.76,-67.5477',
'TXZ147|Fairfield, TX|https://forecast-v3.weather.gov/point/31.7188,-96.1655',
'SDZ021|Millbank, SD|https://forecast-v3.weather.gov/point/45.194,-96.6869',
'MNZ034|Brainerd, MN|https://forecast-v3.weather.gov/point/46.3544,-94.1941',
'COZ010|Vail, CO|https://forecast-v3.weather.gov/point/39.5864,-106.3822',
'CAZ072|South Lake Tahoe, CA|https://forecast-v3.weather.gov/point/38.9333,-119.9833',
'WAZ037|Colville, WA|https://forecast-v3.weather.gov/point/48.5433,-117.8951',
'ILZ014|Hoffman Estates, IL|https://forecast-v3.weather.gov/point/42.0392,-88.11',
'NDZ027|Grand Forks, ND|https://forecast-v3.weather.gov/point/47.9169,-97.072',
'MTZ055|Bozeman, MT|https://forecast-v3.weather.gov/point/45.6354,-111.0633',
'AZZ023|Phoenix|https://forecast-v3.weather.gov/point/33.646,-112.007',
'KSZ078|Dodge City, KS|https://forecast-v3.weather.gov/point/37.7528,-100.0171',
'OKZ020|Stillwater, OK|https://forecast-v3.weather.gov/point/36.1156,-97.0584',
);
//
$SITE['noaazone'] = 'CAZ513'; // change this line to your NOAA warning zone.
//
// set $SITE['fcsturlNWS'] to the URL for the point-printable forecast for your area
// NOTE: this value (and $SITE['noaazone']) will be overridden by the first entry in $SITE['NWSforecasts'] if it exists.
//
$SITE['fcsturlNWS'] = 'https://forecast-v3.weather.gov/point/37.2639,-122.022';
//
$SITE['showTwoIconRows'] = true; // =true; show all icons, =false; show 9 icons in one row (new V5.00)
//
// -- end of converted settings for advforecast2.php JSON version.
-------------------------------------
I'm sure there will be additional updates as the new forecast.weather.gov settles in.
My thanks to the brave beta testers of the advforecast-json.php script! That script is now named advforecast2.php for backward compatibility reasons.
Best regards,
Ken