WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: tmabell on May 16, 2019, 12:19:28 PM

Title: Curly's wxForecastMap.php google->leaflet?
Post by: tmabell on May 16, 2019, 12:19:28 PM
Ken,  Any chance you could make the same change from Google Maps to Leaflet in Curly's old WxForecastMap.php script?  I believe you have a copy but if not I do.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: saratogaWX on May 16, 2019, 12:24:34 PM
I don't seem to have a copy of that .. please send .zip to webmaster at saratoga-weather.org and I'll take a look.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: tmabell on May 16, 2019, 12:33:39 PM
Sent.  Thanks Ken!
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: saratogaWX on May 16, 2019, 01:06:30 PM
Thanks -- I've got it working on my test site.  Cool little script. 

The Leaflet conversion won't be an issue (fairly simple).  The problem is it uses the forecast.weather.gov MapClick.php to get the data, and that functionality is to depart from the site when they do the forecast-v3 -> forecast implementation later this year.
Looks like the script will have to be rewritten to use the api.weather.gov JSON functionality instead of the MapClick.php XML capability.

I'll take a look at doing that (fun little project).
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: tmabell on May 16, 2019, 01:14:44 PM
I was hoping you would want to look at it!  As always, thank you very much!  =D>
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: rrrick8 on May 16, 2019, 10:14:24 PM
Agreed. I've been using Curly's script for quite some while. Help him Alpha and Beta test it.
Hope you have success with it Ken.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: saratogaWX on May 17, 2019, 01:04:08 AM
Been having fun with the conversion (rewrite) to produce it  using Leaflet and the api.weather.gov JSON.

Attached is a sample image of the current output.  I've got to tidy up the script a bit, then I'll let y'all whack on it :)

Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: saratogaWX on May 18, 2019, 02:15:48 PM
Ok folks, it's ready to have you kick-the-tires.  I've attached V2.00 of NWS-forecast-map script which uses Leaflet maps and direct API requests to api.weather.gov (no cache files are used).  It also uses the forecast images directly from api.weather.gov.

Try in a template site at https://saratoga-weather.org/wxtemplates/USA/wxforecastmap.php or native at https://saratoga-weather.org/wxtemplates/USA/NWS-forecast-map.php
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: tmabell on May 18, 2019, 02:56:56 PM
 =D>  Thanks Ken!! [tup]
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: gwwilk on May 18, 2019, 03:08:28 PM
Looks good, Ken.  It's working great here (https://www.gwwilkins.org/wxforecastmap.php)!  =D> \:D/ =D>

Many thanks! [tup]
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: SteveFitz1 on May 18, 2019, 04:08:05 PM
Ken,

Works great and looks great. Thanks very much.

One very minor correction you may want to make. In line 34 of NWS-forecast-map.php, you have "#  put this in the CALLING page for quake-json.php script:".

Steve
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: saratogaWX on May 18, 2019, 04:26:12 PM
Ahh.. cloning is a bit tricky (I borrow a lot from my prior code).  Thanks for your sharp eyes.

I've established a GitHub repository for the script at https://github.com/ktrue/NWS-forecast-map so changes can be tracked.  I'll likely put a scripts page on my site also.  This has been a fun project.. thank y'all for suggesting it.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: Otis on May 18, 2019, 04:41:47 PM
This is really nice Ken, makes a good addition to our sites.  Thanks for this and everything else you do for us and this site.  =D>
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: saratogaWX on May 19, 2019, 08:03:01 PM
I just couldn't let the script go without porting some of the nws-alerts capability to it too..

Now V2.10 - 19-May-2019 will also pull the County Zone alerts (tend to have more activity than the Forecast Zone alerts), and if there are alerts, process them al la nws-alerts-details-inc (for the map polygons, if provided) and produce a red-outlined box with all the alerts shown.  Mouse over an alert link to see a tooltip with the alert contents.  Click the link to go to the NWS page with the alert.
Mouse over the alert polygon drawn on the map, and see a tooltip showing which alert is represented.

Here's a sample display attached, along with V2.10 of the script (only NWS-forecast-map.php and NWS-forecast-map.css have changed).

Best regards,
Ken
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: rrrick8 on May 19, 2019, 08:28:05 PM
Well darn. Spent a few hours today implementing 2.0 into my website. Took a bit to find the proper places to make color changes I wanted.  Now you go and do a brilliant thing like this.
J/k of course. Great work. I think I'll wait until tomorrow to work 2.1 onto the website.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: Otis on May 19, 2019, 08:32:27 PM
Nice addition, thanks again Ken.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: gwwilk on May 19, 2019, 08:37:29 PM
Nicely done, as usual, Ken!  Thanks for the addition which is up and running on my site (https://www.gwwilkins.org/wxforecastmap.php).

 [tup]
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: yamiacaveman on May 20, 2019, 04:32:51 PM
Hey Jerry,

To get it inside your template like you have it, do I have to use the new page template and add this page in or did i miss something? Most new stuff just always seems to open in the Saratoga template.

Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: CNYWeather on May 20, 2019, 04:54:48 PM
Hey Jerry,

To get it inside your template like you have it, do I have to use the new page template and add this page in or did i miss something? Most new stuff just always seems to open in the Saratoga template.

In the Zip the Ken provided, once you make the modifications to the NWS-forecast-map.php file, upload the whole shabang
from the ZIP file and you'll be all set. The wxforecastmap.php page in there takes care of the setup in the page for you.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: yamiacaveman on May 20, 2019, 05:16:17 PM
What a day Tony!!!!

If I would have pointed it to that page, I could have avoided asking the question.

Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: rrrick8 on May 20, 2019, 08:57:46 PM
Have it implemented on my Forecast Page. Fantastic work Ken.
2 small items I'm looking at changing on it.
1) Would be putting a reset map to home button. Been running it through the paces with severe outbreak in southern plains but just refreshing the page does not return it to home, need to actually click menu link to Forecast Page to get it to return.
2) Have links to Warnings details open in new tab instead of current tab.

Minor items. Wonderful work Ken and it has performed admirably tonight with the high threshold of warnings in the plains.
 =D> =D> =D>

http://vermilionweather.com/forecast.php
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: mikeym2m on May 21, 2019, 10:06:33 AM
Ken

Working Great - Thanks  [tup]  http://mikeymsweather.com/wxforecastmap.php

Only think I dislike about the new NWS forecast is they show me "6 Miles WSW from Big Bass Lake, PA" when it used to be 3 Miles NW from Thornhurst". I know it has nothing to do with your script, but is a NWS issue.

Cheers

 :-)

MikeyM
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: saratogaWX on May 21, 2019, 10:31:39 AM
Have it implemented on my Forecast Page. Fantastic work Ken.
2 small items I'm looking at changing on it.
1) Would be putting a reset map to home button. Been running it through the paces with severe outbreak in southern plains but just refreshing the page does not return it to home, need to actually click menu link to Forecast Page to get it to return.
2) Have links to Warnings details open in new tab instead of current tab.

Minor items. Wonderful work Ken and it has performed admirably tonight with the high threshold of warnings in the plains.
 =D> =D> =D>

http://vermilionweather.com/forecast.php

Good ideas... I'll add both to the script.  The target="_blank" will be a settings option.  The script generates XHTML1.0-Strict and that option on links is only valid on XHTML1.0-Transitional.

Thanks for the suggestions.

Ken

Working Great - Thanks  [tup]  http://mikeymsweather.com/wxforecastmap.php

Only think I dislike about the new NWS forecast is they show me "6 Miles WSW from Big Bass Lake, PA" when it used to be 3 Miles NW from Thornhurst". I know it has nothing to do with your script, but is a NWS issue.

Cheers

 :-)

MikeyM
Glad it's working for you.  The title/distance stuff is (as you say) all from the NWS (in the gridpoint forecast).  I do display the direction/miles from place only if it's greater than 1 mile.. cuts down on the 'clutter'.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: rrrick8 on May 21, 2019, 12:24:26 PM
Have it implemented on my Forecast Page. Fantastic work Ken.
2 small items I'm looking at changing on it.
1) Would be putting a reset map to home button. Been running it through the paces with severe outbreak in southern plains but just refreshing the page does not return it to home, need to actually click menu link to Forecast Page to get it to return.
2) Have links to Warnings details open in new tab instead of current tab.

Minor items. Wonderful work Ken and it has performed admirably tonight with the high threshold of warnings in the plains.
 =D> =D> =D>

http://vermilionweather.com/forecast.php

Good ideas... I'll add both to the script.  The target="_blank" will be a settings option.  The script generates XHTML1.0-Strict and that option on links is only valid on XHTML1.0-Transitional.

Thanks for the suggestions.

Ken

Working Great - Thanks  [tup]  http://mikeymsweather.com/wxforecastmap.php

Only think I dislike about the new NWS forecast is they show me "6 Miles WSW from Big Bass Lake, PA" when it used to be 3 Miles NW from Thornhurst". I know it has nothing to do with your script, but is a NWS issue.

Cheers

 :-)

MikeyM
Glad it's working for you.  The title/distance stuff is (as you say) all from the NWS (in the gridpoint forecast).  I do display the direction/miles from place only if it's greater than 1 mile.. cuts down on the 'clutter'.
I'll throw one other thing out there for your consideration Ken. Like I posted earlier I was an alpha tester for Curly on this script and back then he had an option to save location from the map script. That was for users who are not in the same location as the website is being able to save their own location on the map. I can look through old messages from curly and see if I can find that if you are interested.

Sent from my SAMSUNG-SM-G928A using Tapatalk

Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: saratogaWX on May 21, 2019, 12:36:38 PM
Sure, send along Curly's older code for that.. I expect that some browser cookies are involved to save it as a user setting on the browser.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: rrrick8 on May 21, 2019, 01:36:18 PM
Sure, send along Curly's older code for that.. I expect that some browser cookies are involved to save it as a user setting on the browser.

PM sent.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: Breezy on May 21, 2019, 10:48:58 PM
Great job Ken as always!  \:D/ . We're all very fortunate to have your skills and support. Thank you!  =D>

Here is Indian Trail Weather, Hessville, NY  https://indiantrailweather.com/wxforecastmap.php
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: mikeym2m on May 24, 2019, 09:13:52 AM
Worked Great last night with the "Special Weather Statement", "Severe Thunderstorm Warning" and "Tornado Warning" correctly showing.   [tup]

Thanks Ken

Cheers

  :-)

MikeyM
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: MackerelSky on May 25, 2019, 06:23:10 PM
Working great as usual Ken, some severe weather moving in and watches/warnings are working.
https://www.mckeanweather.com/mwCforecast.php

Had a nice little poke around that Leaflet site for the mapping, some interesting stuff...

Thanks again for all your work.
Brad
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: saratogaWX on May 25, 2019, 07:44:19 PM
Hi Brad,
Nice restyling on the display of the WX-forecast-map script. 

BTW.. you should replace your NEWN and MAWN network maps with the mesonet-map set of scripts.. the old *-mesomap.php set of scripts for the network stopped being supported on Sept. 1, 2016 -- https://saratoga-weather.org/scripts-mesonet-map.php for a copy that can display any regional network on a Leaflet map.
Title: Re: Curly's wxForecastMap.php google->leaflet?
Post by: MackerelSky on May 26, 2019, 06:26:24 AM
Thx Ken,

Love that 'border-radius', *grin*

Will get after the map this afternoon and see what I can come up with.

All the Best!

Brad