Author Topic: Updated advforecast2.php (JSON) V5.11 handles NWS API change  (Read 1492 times)

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 156
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
Updated advforecast2.php (JSON) V5.11 handles NWS API change
« on: April 30, 2019, 07:40:26 PM »
With the announcement of the NWS on 29-Apr-2019 that the api.weather.gov was deprecating the forecast queries for points/ and removing the current 302 redirect to a gridpoint forecast, the underlying method of using the API had to change in the script.

Now, the specified point's meta-data is fetched first (from cache if available, otherwise fetched from API and cached) and the gridpoint forecast is used directly (based on the meta-data content).   The prior caching method (in ./cache/forecast-URLcache.txt) is no longer used (that had contained the point->gridpoint URLs). 

Now the ./cache/forecast-{zone}-{N}-json-meta.txt file contains all the relevant data about the specified point that was derived from multiple API fetches re: point, Zone, WFO and saved.

If you're using the V5.10 script, please update before 24-Jun-2019 when the NWS will turn off the 302 redirect for the point forecast and that version of the script will likely fail to work properly.

Standalone update: use the script page for download.
Saratoga Template(USA): use the update tool page with query Base-USA, Plugin-*, 30-Apr-2019
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Blicj11

  • Storm
  • *****
  • Posts: 3941
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Ventura 13.6 | Sharx SCNC2900 Webcam | WeatherCat 3.3 | Supportive Wife
Re: Updated advforecast2.php (JSON) V5.11 handles NWS API change
« Reply #1 on: April 30, 2019, 07:55:06 PM »
Thanks for keeping up with this, Ken, and for the link to their announcement.
Blick