You can use multiple lat-lon areas
→ setup in wrnWarningEU.php
→ check lines 15 → 30 of the code
And still use multiple geocode areas
→ as setup in your current easyweather-settings
Use these scripts if you really need them.
Some countries, see next post, already switched from ID’s to polygons only.
Backup your current wrnWarningEU.php script.
The other 3 scripts for CAP, RSS and ATOM, have a new name.
Test these scripts if you want to help me testing them, but better not on your “production” website.
If you have no download token but you need to test these scripts, sent a PM and I will sent you the scripts.
Background:
MeteoalarmEurope is rapidly moving towards a new CAP data structure probably end of the year. There is no documentation what they want to change, but it will be a very busy period early next year.
Drawbacks for us:
More website-hosting resources - longer response times
New extra hazard types, we have to find graphics for those
Extra translation-problems for more and longer hazard-descriptions
File size problems:
The 5 characters of the current geocode are replaced with a polygon of 6.500+ characters and that for every language used. 5 languages * 6.500 extra characters.
A Swiss warning has grown from less than 6.500 characters to over 39.000 characters.
Currently the Swiss download from the Swiss servers takes 18-19 seconds to finish. https://feeds.meteoalarm.org/api/v1/warnings/feeds-switzerland
Often the browser will end with a message “website is not responding”
I sincerely hope that the scripts will also work with “cheaper” hosting packages.
The Swiss download has 879 warnings and the size is 33 mb. That is 5 times larger than the next , the Netherlands, although that country has a ridiculous 3.618 warnings but the file-size is 6 mb. If the Netherlands would switch to polygons the file would grow to over 100 mb? Which hosting company will allow us to download even one 100+ mb file every 15 minutes?
Discuss / decide to move list of “lat-lon” areas to easyweather
→ pro no user settings in the main meteoalarm script
→ con how many areas needed for the largest users
→ con most users only need 1 area
Enhance
The final release will contain an adapted PWS_easyweathersetup.php script to use a file with all “center-points” for all current EMMA-ID’s.
That file is generated by @ktrue using the meteoalarm gecodes.json file.
That way the pwsWD 2012_lts users only need to open easyweather, press save and for each of their alarm-areas (on the Data-tab) the correct lat-lon values are entered.
That plural of “value” is no typo, some geocode areas have multiple polygons, sometimes 2 or 3, but a few have more. I quote Ken again:
To be solved
→ Some countries are still using NUTS2 as a geocode. F.i. Belgium. I will have to check which area-codes are used and if they are contained in the meteoalarm geocodes.json file. I will add the NUTS2 and "old EMMA-ID to the @ktrue list.
Anyone can check how recently the codes were used at “Warning-areas found in meteoalrm “all-warnings” feed”
My scripts now return a Message Allowed memory size of 134217728 bytes exhausted (tried to allocate 8192 bytes) in the json_decode instruction of that far to big file with 1151 warnings.
In a few days the file-size has grown from 33MB to 47MB.
I will further test without CHxxx area codes.
Today I feel like Don Quixote
Maybe not fighting windmills, but against the technical staff of a Swiss company behind MeteoAlarm.org
I tried to tell them that - well, I said it was a massive waste of their resources! - and they just said it’s entirely up to the participating members. And “If you have any concerns related to a specific country or warning, I kindly suggest that you get in touch with the Alerting Authority, MeteoSwiss, in [this] case.”
I’m still working on refining the calcs/computation for center/middle points of oddly shaped polygons, but the simple algorithm I’m using shows good results for the majority of the areas.
I don’t have any authoritative knowledge of how the US NWS does the forecasts for severe weather polygons, but I’m assuming that a human forecaster will ‘draw’ on an app and thereby create the polygon (for severe weather/tornado maybe) and use ‘canned’ polygons from shapefiles for flood warnings, For general weather alerts, it’s usually done with Zones (like EMMA_IDs) as part of the alert, and each Zone has a fixed polygon described in shapefiles (which are published by the NWS GIS office GIS),
If the international forecasters are just drawing lines on a map (using an application) to publish the alert, then today’s and tomorrow’s polygon could be different. Seems to me to be simpler for them to pick polygons from a map list than to draw a specific one (unless it is for a very localized weather phenomenon ).
And even simpler to pick a geocode or two - assuming the geocode areas are small enough for the detail required?
I complained bitterly that UK Met Office used to use large area geocodes - 17 to cover the whole UK - especially since “mine” covered SW Scotland, Lothian & Borders, so I have to say I was delighted when they came up with 153 recently. . .
No worries about UK315 … the polygons resulted in a center that’s in the largest island, so ok…
I’m trying to add a selector to add a geojson layer to my map that fetches the alert polygons and displays them so we can see what is happening for those countries that alert by polygon only.
I’m waiting to revise my get-meteoalarm-warning-inc.php script until Wim settles on a version for PWSdashboard since my script is largely based on his work (stolen with permission )
That is why they want to sent the polygons with every warning.
So there is no fixed polygon for UKnnn in the meteoalarm.org data-base anymore.
The only way is to “pray” that the countries will use mostly the “old” polygon.
The dashboard scripts will (already do) use the lat/lon of the station, albeit there is a setting to use the centerpoint.
All other extra areas will be using Ken’s centerpoint from the file he supplied.
So in the end we will probably catch the warnings for our own station.
And often also the warnings for neighbouring areas.
But we will miss some.
The old list of three adjacent areas f.i. BE00x,BE00y, NL00z will not have adjacent polygons and the centerpoints from the file can often be outside a smaller nearby area warning.
The “full-page” website templates could have a “local-area” map with all close-by warnings. There is enough room on the startpage.
But a dashboard type template only shows a dozen or more small blocks.
The map should be in a pop-up similar to the current text-only pop-up.
The problem remains, how do we know that there is a warning in our and adjacent areas.
Currently coding the translations from NUTS and FIPS to EMMA_ID
A few days testing and will add the next beta Monday.
Another feature we loose:
In the past when giving a list of areas, the scripts could show one warning for all areas with the same warning.
F.i. Snow BE001, BE13, BE14
That is not possible as from now every warning for every area has a unique key.
And seems to contain only 1 area plus a description in every language for that country.
I updated a previous post with the list of countries and yes the UK is still on geocodes and it does not need aliases as it is using official EMMA-ID’s
Yes, UK is doing it the efficient way.
One “record” has the alert data, has all area-geocodes for that alert, and the description in (just) 1 language.
Sadly the swiss example of how not to do it.
A warning has one area only and one polygon for every language.
wrnWarningEU-CAP2.php (line 164)
→ switzerland json =31.259.728 characters
→ array_size=66.957.912 time used: 0.4357 seconds
wrnWarningEU-CAP2.php (line 249)
Checked if alerts available for CH_warning-areas: time used: 15.3636 seconds
wrnWarningEU-CAP2.php (250) warnings: 797 in the file
→ alert_plgn: 3675
→ checked polygons: 3675 797 alerts * 5 languages
→ used areas/language: 0
Belgium has
Has 1 separate alert for each affected geocode-area and the for every language the description
I will adept the script and assume that all languages will have the same polygon.
The CAP designers should move the polygon one level up in the CAP
If a geocode is available, the same number of alerts would use less than 0.1 second
As is proved with UK and other countries.