Author Topic: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps  (Read 1399 times)

0 Members and 1 Guest are viewing this topic.

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
I'm still doing some refining of the code, but for the brave amongst you, attached is V4.00 (beta) of the Regional mesonet-map.* scripts.

Please note that 2 images have been added to MESO-images (layers.png and layers-2x.png), otherwise the image set is unchanged from the V3.x series.

This will support a Mapbox API key to enable two additional maps, but does not require an API key to use the 5 built-in maps in the script.

Let me know any issues found.  I hope to release (with docs) the V4.00 version later this week.

Best regards,
Ken
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 spweather

  • Contributor
  • ***
  • Posts: 130
    • Sand Point Weather
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #1 on: May 22, 2018, 10:24:14 AM »
Very nice, thank you Ken.

I'm liking the Leaflet/OpenStreetMaps.

This is my first implementation of the Regional Mesonet-Maps. If I wish to modify a couple of the script settings, for example...

Code: [Select]
$SITE['rmMapUseDefaults'] = 'False';
$SITE['rmShowFireDanger'] = 'False';
$SITE['rmMapZoom'] = '5';
Would I then have to enter a line for ALL of the available settings? Or can I just include the settings I wish to change and the others would resort to the default?

Dennis
« Last Edit: May 22, 2018, 02:07:50 PM by spweather »
Regards,
Dennis

- Davis Wireless Vantage Pro2 Plus w/24hr FARS
- Davis (Ultra)Sonic Anemometer
- Boltek/MicroLDN TOA Lightening Detection
- Porcupine Labs LR4/Fluke 414D Laser Rangefinder snow depth measuring sensor


Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #2 on: May 22, 2018, 12:16:11 PM »
Hi Dennis,
Yes, when rmMapUseDefaults = false, then you have to set the rmMapZoom, rmMapCenter, rmTempUOM, rmWindUOM, rmBaroUOM and rmRainUOM values to your liking as none of the defaults for the selected network will be applied. They can be set in mesonet-map-settings.php or in Settings.php as you've shown (the Settings.php ones will override).
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 UpstateWeather.com

  • Signature
  • Contributor
  • ***
  • Posts: 146
    • Upstate Weather
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #3 on: May 22, 2018, 12:33:09 PM »
Thanks Ken! As always, you do amazing work.

I have it up and running on my site. Wasn't too hard at all, though I haven't been able to get the quake pages to show the map. I also haven't had time to look at the script.

Thanks again!!
Eric

Offline spweather

  • Contributor
  • ***
  • Posts: 130
    • Sand Point Weather
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #4 on: May 22, 2018, 12:53:29 PM »
Thanks (again) Ken.

Dennis
Regards,
Dennis

- Davis Wireless Vantage Pro2 Plus w/24hr FARS
- Davis (Ultra)Sonic Anemometer
- Boltek/MicroLDN TOA Lightening Detection
- Porcupine Labs LR4/Fluke 414D Laser Rangefinder snow depth measuring sensor


Offline spweather

  • Contributor
  • ***
  • Posts: 130
    • Sand Point Weather
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #5 on: May 22, 2018, 01:21:17 PM »
Regarding; modified settings...

I'm not sure what I'm doing wrong, I have the following modified settings in my Settings.php

Code: [Select]
$SITE['rmNETID'] = 'MWWN'; // used in mesonet-map (see https://saratoga-weather.org/scripts-mesonet-map.php)
$SITE['rmMapUseDefaults'] = 'false'; // used in mesonet-map
$SITE['rmShowFireDanger'] = 'false'; // used in mesonet-map
$SITE['rmMapZoom'] = '8'; // used in mesonet-map
$SITE['rmMapCenter'] = '43.91, -83.38'; // used in mesonet-map
$SITE['rmTempUOM'] = 'F'; // used in mesonet-map
$SITE['rmWindUOM'] = 'mph'; // used in mesonet-map
$SITE['rmBaroUOM'] = 'inHg'; // used in mesonet-map
$SITE['rmRainUOM'] = 'in'; // used in mesonet-map
But I don't see any change on my page

Dennis
Regards,
Dennis

- Davis Wireless Vantage Pro2 Plus w/24hr FARS
- Davis (Ultra)Sonic Anemometer
- Boltek/MicroLDN TOA Lightening Detection
- Porcupine Labs LR4/Fluke 414D Laser Rangefinder snow depth measuring sensor


Online wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #6 on: May 22, 2018, 01:32:31 PM »
You have two lines you want to set to false
Code: [Select]
$SITE['rmMapUseDefaults'] = 'false'; // used in mesonet-map
$SITE['rmShowFireDanger'] = 'false'; // used in mesonet-map
You have to remove the quotes around the word false
Those two lines should look like this:
Code: [Select]
$SITE['rmMapUseDefaults'] = false; // used in mesonet-map
$SITE['rmShowFireDanger'] = false; // used in mesonet-map
The word false (without quotes) is a keyword in the PHP language.

Anything within  quotes is a string and the compiler does not catch the 'false' inside quotes as the keyword false.

Wim

Offline spweather

  • Contributor
  • ***
  • Posts: 130
    • Sand Point Weather
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #7 on: May 22, 2018, 01:44:24 PM »
That did the trick, thanks Wim.

Dennis
Regards,
Dennis

- Davis Wireless Vantage Pro2 Plus w/24hr FARS
- Davis (Ultra)Sonic Anemometer
- Boltek/MicroLDN TOA Lightening Detection
- Porcupine Labs LR4/Fluke 414D Laser Rangefinder snow depth measuring sensor


Offline ConligWX

  • Forecaster
  • *****
  • Posts: 840
  • #conligwx
    • conligwx.org
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #8 on: May 22, 2018, 04:40:09 PM »
Updated on mine, Thanks for your hard work Ken!

is it possible to have zoom of 0.5 increments also?
« Last Edit: May 22, 2018, 04:47:27 PM by Toxic »
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #9 on: May 22, 2018, 07:02:55 PM »
Alas, Zoom only happens in integer values with zooms from 2 to 18 available on most maps. (Zooms of 0 and 1 show multiple earth copies)

Zoom 18 is about 1:1381 scale.
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 BeaumarisWX

  • Senior Member
  • **
  • Posts: 50
    • BeaumarisWX
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #10 on: May 23, 2018, 02:39:52 AM »
Hi,
I just noticed on Toxic's UK version (pity about naming of site) for "Westerhope, Tyne & Wear".

The '&' throws an XHTMl error. https://validator.w3.org/check?uri=https%3A%2F%2Fwww.conligwx.org%2Fwxmesonetmap.php;accept=text%2Fhtml%2Capplication%2Fxhtml%2Bxml%2Capplication%2Fxml%3Bq%3D0.9%2Cimage%2Fwebp%2Cimage%2Fapng%2C%2A%2F%2A%3Bq%3D0.8;accept-language=en-GB%2Cen%3Bq%3D0.9%2Cen-US%3Bq%3D0.8%2Ces%3Bq%3D0.7
Was obviously always there, just never checked before.
Regards,
Tony Beaumaris, Tasmania (Australia)
CumulusMX GUI : https://beaumaris-weather.com/MXUI/
Saratoga Template : https://beaumaris-weather.com

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #11 on: May 23, 2018, 07:47:48 AM »
Quote
Alas, Zoom only happens in integer values with zooms from 2 to 18 available on most maps. (Zooms of 0 and 1 show multiple earth copies)

Just to note that fractional zoom is possible by setting the zoomDelta option to something more granular when creating the map. The downside is that each +/- click only moves by that amount, so zooming is slower.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6367
    • Valentine Nebraska's Real-Time Weather
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #12 on: May 23, 2018, 10:48:28 AM »
I tried the script but was only showing 4 mesonet stations for all of Nebraska. Missing 56+ stations statewide. Are they not part of the network being used for script?

All stations link: https://mesonet.unl.edu/stations/
Randy

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #13 on: May 23, 2018, 01:23:30 PM »
The stations shown are all members of the Midwestern Regional network ( https://midwesternweather.net/ ) -- the mesonet.unl.edu stations are a different network and not displayed by the script.

The mesonet-map script set only displays stations that are members of the regional networks, not other mesonets.
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

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #14 on: May 23, 2018, 01:30:33 PM »
Based on some feedback from Wim and others, I've added a few tweaks to the script set.  The updated scripts (only) are attached.

Now a right-click on the map will bring up a context menu that allows you to:
1) see the lat/long of the point
2) show what settings need to be to reproduce this map as a default
3) center map to that point
4) zoom out or zoom in

The links all now follow the $doLinkTarget setting to create a target="_blank" (default is to do that).

The markers no longer display a rotating conditions label for Offlline stations.

Using ?cluster=nn  (nn = 5 to 80) allows adjustment of the clustering algorithm.  Higher numbers for more clustering.  The right-click context menu "Show Map Settings" will display the current rmClusterRadius value.

Town/county/state names with '&' will use '&' instead for HTML validation.

« Last Edit: May 23, 2018, 02:14:35 PM 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 ValentineWeather

  • Forecaster
  • *****
  • Posts: 6367
    • Valentine Nebraska's Real-Time Weather
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #15 on: May 23, 2018, 01:45:40 PM »
The stations shown are all members of the Midwestern Regional network ( https://midwesternweather.net/ ) -- the mesonet.unl.edu stations are a different network and not displayed by the script.

The mesonet-map script set only displays stations that are members of the regional networks, not other mesonets.

Thanks! Maybe they will eventually get on same network like NeRain and Cocorahs did.   
Randy

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Regional mesonet-map scripts (beta) with Leaflet/OpenStreetMaps
« Reply #16 on: May 23, 2018, 02:12:03 PM »
Hi,
I just noticed on Toxic's UK version (pity about naming of site) for "Westerhope, Tyne & Wear".

The '&' throws an XHTMl error. https://validator.w3.org/check?uri=https%3A%2F%2Fwww.conligwx.org%2Fwxmesonetmap.php;accept=text%2Fhtml%2Capplication%2Fxhtml%2Bxml%2Capplication%2Fxml%3Bq%3D0.9%2Cimage%2Fwebp%2Cimage%2Fapng%2C%2A%2F%2A%3Bq%3D0.8;accept-language=en-GB%2Cen%3Bq%3D0.9%2Cen-US%3Bq%3D0.8%2Ces%3Bq%3D0.7
Was obviously always there, just never checked before.
Regards,
That's an easy fix.. in mesonet-map-json.php to change '&' to '&' for the town/state/county names.  Included in the update above.
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

 

anything