Page 1 of 1

NOAA Weather Radio

Posted: Fri 13 Apr 2018 12:15 pm
by acatalano
I have been streaming NOAA Weather Radio via noaaweatherradio.org and have been using wxradio.php on my website: http://www.boulderwx.com. Ken's page displays the map and the location of the radio on a google api generated map. This has been working very well for about a month or more. In order to implement this, one needs to get a Google Maps API key, which is free. Again, this has been easy to do, and just works...until now

Suddenly, yesterday the map would not display and the Javascript console shows an API key error. I've tried generating a new key, restricting it to http requests etc., but no matter what I've tried, the map displays briefly then generates the error. Of course the audio still works but no map.

I'm no Javascript programmer so I could use some advice. Coincidentally I just updated my out-of-date pages, but wxradios.php was not one of them. Any ideas?

Re: NOAA Weather Radio

Posted: Fri 13 Apr 2018 1:23 pm
by beteljuice
In your html you have ..

Code: Select all

<script async="" defer="" src="https://maps.googleapis.com/maps/api/js?key=-replace-this-with-your-API-key-here-&language=en">
... so where is your API key ?

Re: NOAA Weather Radio

Posted: Fri 13 Apr 2018 2:05 pm
by acatalano
I have been putting it after key= in single quotes within wxradio.php. That's where it has been from the start, and when it (used to) display the maps properly. There are actually two places to put the API key. I had inserted the key within wxradio.php file, where it seemed to work. However, at the top of the file Ken mentions that it can be put in settings.php so it applies site-wide. Like this:

$SITE['googleAPI'] = 'key goes here'; // key used for all Google Maps on site

Putting it in settings.php overides the one in wxradio.php. I kinda feel like I must be crazy...worked for a month or so, then without touching the file, it stops.

So I solved the problem with a new key by putting it in Settings.php, and now the map displays properly. Not sure why it stopped but it's working perfectly again!

Problem solved!

Re: NOAA Weather Radio

Posted: Fri 13 Apr 2018 8:59 pm
by acatalano
After re-reading my post I want to clarify the solution. The problem arose with the Googlemaps API key within wxradio.php. It was apparently solved by putting it into settings.php as shown in the post.