Author Topic: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available  (Read 1713 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
I've updated Curly's nws-alerts V1.42 package to use Leaflet/OpenStreetMaps instead of Google maps, so no API key is needed anymore.  Support for optional Mapbox.com API key is provided.

The Saratoga Base-USA template was updated, so use the update tool with a query of Base-USA, Plugin-*, 14-May-2019.

The standalone script set was also updated on the legacy scripts page and I've attached a small zip with the changed files.  (note that nws-alerts.php V1.43 is only a version rev from V1.42).

Also the full script set is available on my GitHub distribution
« Last Edit: May 15, 2019, 11:27:20 AM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #1 on: May 14, 2019, 12:23:07 PM »
As always, thanks  [tup]
Wim

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #2 on: May 15, 2019, 12:30:08 AM »
Great job, as usual!  Thanks, Ken. [tup] =D>
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #3 on: May 15, 2019, 08:45:04 AM »
A little glitch here with xhtml validation.

There's probably a simple fix, but it's beyond my ken, Ken.  :-)
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #4 on: May 15, 2019, 10:47:55 AM »
Ahh.. the validator was parsing the HTML inside the <script>...</script>

I've added
Code: [Select]
<script>
// <![CDATA[ 

...

// ]]>
</script>
to have the parser stop trying to do that and become annoyed :)

Try the attached replacement.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #5 on: May 15, 2019, 10:59:50 AM »
I've pushed that change to the Base-USA template, the Legacy-scripts and the GitHub distributions.  Thanks for spotting that omission.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline txweather.org

  • Forecaster
  • *****
  • Posts: 1597
    • Texas Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #6 on: May 15, 2019, 11:09:25 AM »
Thanks Ken!

----
Davis Vantage Pro2 Plus +FARS|Meteobridge Nano SD|Meteohub|Meteobridge MR-3020|WU KTXSPRIN75/PWS JRARGWX75/CWOP EW2972/WBB TXWDVUE75/Blitzortung ID: 1142|AWEKAS: 12095
Donations are welcome: https://paypal.me/ffuentesb

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #7 on: May 15, 2019, 11:12:53 AM »
I had already corrected another little glitch with this addition of 'type' to the javascript call:
Code: [Select]
$leafletScript = '<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.3/leaflet.js" type="text/javascript"></script>'."\n";Again the validator for xhtml complained about this omission which is useless these days, really.

Thanks, Ken!  I had no idea what to do, but the CDATA exclusion is perfect.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #8 on: May 15, 2019, 11:19:59 AM »
Again the validator for xhtml complained about this omission which is useless these days, really.

Yup. And it is no longer necessary in HTML5.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #9 on: May 15, 2019, 11:26:33 AM »
Ahh... for XHTML, it's needed.  HTML5 not needed.  Since the templates use XHTML 1.0 Transitional, I've added that to the script.. thanks again.

BTW, it was an interesting challenge to modify Curly's original Google map script to do Leaflet instead .. a bit of somewhat convoluted PHP to generate the inline script only if the alert had geo-coordinates present, and quite a change in the generated JavaScript to control Leaflet due to differently named/accessed Leaflet functions v.s. Google maps functions.

Posted in the usual places...
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline tmabell

  • Forecaster
  • *****
  • Posts: 394
    • Mishawaka Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #10 on: May 21, 2019, 08:22:00 AM »
Quick question Ken, doe the latest version still support "Filtered Events" or was that feature removed?  I ask because I did not see the necessary files in your GitHub distribution package.
« Last Edit: May 21, 2019, 08:23:43 AM by tmabell »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #11 on: May 21, 2019, 10:34:19 AM »
All the filtering features from Curly's 1.42 version are still there .. I only replaced the Google map with the Leaflet map generation.

What was missing in the GitHub package??  I may have skipped something when packaging it for GitHub.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline tmabell

  • Forecaster
  • *****
  • Posts: 394
    • Mishawaka Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #12 on: May 21, 2019, 10:52:27 AM »
If you need these file I will forward them to you but these are needed in order to configure the filters:

nws-alerts-events.php
nws-alerts-filter-config.php
nws-alerts-filtering.php

Thank you for keeping these old scripts alive!

Offline mldenison

  • Contributor
  • ***
  • Posts: 111
    • York, PA Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #13 on: May 21, 2019, 10:54:56 AM »
Hey Ken,

The new version is working fine on my PC.

The 'check-fetch-times.php' has an 'unknown' for 'nws-alerts.css':

Windows 7 x64
Weather PC: Intel NUC
Davis Vantage Pro 2
Weather Underground: KPAYORK30
York, PA Weather (Saratoga)
York, PA Weather (Leuven)
York, PA PWS Station

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #14 on: May 21, 2019, 11:09:04 AM »
If you need these file I will forward them to you but these are needed in order to configure the filters:

nws-alerts-events.php
nws-alerts-filter-config.php
nws-alerts-filtering.php

Thank you for keeping these old scripts alive!

Yes, please .zip and send me those files... I see the .zip and GitHub only have ./cache/nws-alerts-filters.php in it.. the other files you cited are not there.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #15 on: May 21, 2019, 11:10:13 AM »
Hey Ken,

The new version is working fine on my PC.

The 'check-fetch-times.php' has an 'unknown' for 'nws-alerts.css':


I'll check.. I think maybe the versioning info is not in the CSS file.  Thanks...
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #16 on: May 21, 2019, 12:34:19 PM »
Hey Ken,

The new version is working fine on my PC.

The 'check-fetch-times.php' has an 'unknown' for 'nws-alerts.css':

Ahh... I discovered there was some missing code to have the .css files version info included in the version-list.  I've updated that (and check-fetch-times.php V1.27 also) so the versioning on .css scripts needed are now included in the display.
Pushed Version 3.292 - 21-May-2019 (Base-*) updated check-fetch-times.php V1.27 for .css file version checking
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline mldenison

  • Contributor
  • ***
  • Posts: 111
    • York, PA Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #17 on: May 21, 2019, 01:21:01 PM »
Works great, Ken.  Thanks for the quick update!
Windows 7 x64
Weather PC: Intel NUC
Davis Vantage Pro 2
Weather Underground: KPAYORK30
York, PA Weather (Saratoga)
York, PA Weather (Leuven)
York, PA PWS Station

Offline mikeym2m

  • Senior Contributor
  • ****
  • Posts: 153
    • MikeyM's Thornhurst PA Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #18 on: May 24, 2019, 09:16:00 AM »
Thanks Ken

Worked Great last night with the "Special Weather Statement", "Severe Thunderstorm Warning" and "Tornado Warning" all showing correctly.  [tup]

Cheers

 :-)

MikeyM

Offline tshattuck

  • Forecaster
  • *****
  • Posts: 337
    • Your Local Weather - Clay, NY
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #19 on: May 27, 2019, 11:12:16 AM »
Ken:
I noticed in your posts here you mention MapBox is optional. I don't have an API Key for MapBox what happens if I don't have API key?

Thanks

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 724
    • Lake Huron Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #20 on: May 27, 2019, 11:46:33 AM »
I believe it just eliminates the mapbox map display options like satellite.  I don't think it will effect the performance of the script.

CW3699

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #21 on: May 27, 2019, 12:23:44 PM »
Ken:
I noticed in your posts here you mention MapBox is optional. I don't have an API Key for MapBox what happens if I don't have API key?

Thanks

The default behavior is to use the Esri_WorldTopoMap, tiles which needs no key. You only need the Mapbox key if you want to use Mapbox tiles.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline tshattuck

  • Forecaster
  • *****
  • Posts: 337
    • Your Local Weather - Clay, NY
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #22 on: May 27, 2019, 08:27:37 PM »
I will go without the API Key based on your comments. I want to keep it simple.
Thanks for the feedback.

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 724
    • Lake Huron Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #23 on: May 27, 2019, 09:23:27 PM »
Just to be clear, I never said not to get the API Key, just that you don't need one for the script.
I do have one, the key.

CW3699

Offline mldenison

  • Contributor
  • ***
  • Posts: 111
    • York, PA Weather
Re: nws-alerts.php V1.43 with Leaflet/OpenStreetMap now available
« Reply #24 on: May 27, 2019, 09:38:06 PM »
I added my (unused) mapbox api key.  Everything still looks the same.  Anybody want to share a link to their page that uses mapbox?  Thanks.
Windows 7 x64
Weather PC: Intel NUC
Davis Vantage Pro 2
Weather Underground: KPAYORK30
York, PA Weather (Saratoga)
York, PA Weather (Leuven)
York, PA PWS Station