Author Topic: mod to JSON version of forecast script  (Read 340 times)

0 Members and 1 Guest are viewing this topic.

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 373
    • LexMAWeather
mod to JSON version of forecast script
« on: June 28, 2018, 11:26:36 AM »
The JSON / new API version of Ken's forecast script uses the zone ID to fetch any alerts to be displayed along with the forecast. Unfortunately, this sometimes misses advisories that only use the county codes and do not explicitly list the zones. I found what might be a quick fix to this.

In each case that ALERTAPIURL is defined, I changed the code:

Code: [Select]
//  define('ALERTAPIURL','');

And then when ALERTAPIURL is used...

Code: [Select]
//    $alertURL = ALERTAPIURL.$NOAAZone;
$alertURL = ALERTAPIURL . $newlatlong;

This pulls in everything associated with the point no matter what codes are included.

I left the naming of the cache file (w/ zone name) the same and it seems to work, but I have a testing sample size of one so far. Will test further...

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7013
  • Saratoga, CA, USA Weather - free PHP scripts
Re: mod to JSON version of forecast script
« Reply #1 on: June 29, 2018, 10:12:57 AM »
Good idea... I'll add to the script.

The only downside is the legend will display the lat/long of the alert instead of the alert zone name as far as I can tell.

Thanks for the find!
Ken True/Saratoga, CA, USA main site:
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP