Problems with Saratoga mesomaps

I have recently tried to upgrade my website to include mesomaps, specifically the Scottish Weather Network version. I have asked for help from the SCWN forum, but nothing has happened. I use the Saratoga scripts with some mods. I have used the instructions supplied from the Saratoga website.
Basically, there are three main problems I have with the mesomaps on my website. The first is that I can’t get the zoom and initial centre of the map to start to my selected figures, the system ignores all inputs of zoom or initial latitude and longitude. I have set $SITE[‘rmMapUseDefaults’] to false as specified in the set up instructions as well as $SITE[‘rmMapZoom’] and $SITE[‘rmMapCenter’] (all in Settings.php)
Secondly, when the system starts up, it is supposed to rotate from one quantity to another. But on my website, it misses out many of the parameters. If you look at my website you will see what I mean; it shows dewpoint wind and barometer but not temperature, humidity or rainfall. Pressing “Pause” and then “run” causes all parameters to be shown, but surely they should all show from the start?
The third problem (I think) is that the system gets the clientraw.txt file directly from the website instead of the position given in Settings.php which shows the correct place to find clientraw.txt is from./live/ on my website.

If you try looking at my website which is http://sidlawweather.co.uk and click on the flyoutmenu option for SCWN you will see what I mean.
Clicking on the SCWN logo (further down below the flyoutmenu) the second problem doesn’t exist but the others do. Naturally, I want the mesomap to start up correctly from the flyoutmenu.

I hope someone can point out the error of my ways.
John

Hi John,
Perhaps, I can assist :slight_smile:

I note that the JavaScript console shows one error that may be impacting your site. In ajaxWDwx-settings.js you have a line

moonImg.src   = ./cloudbase/moon/+"moon/{BG}/{NS}-moon{AGE}.gif"; // replacements: {BG}=[w=white|b=black], {NS}=[NH|SH], {AGE}=[00..27]

and that is missing a set of quotes – it should read

moonImg.src   = "./cloudbase/moon/"+"moon/{BG}/{NS}-moon{AGE}.gif"; // replacements: {BG}=[w=white|b=black], {NS}=[NH|SH], {AGE}=[00..27]

I’ve noticed that any syntax erratum in any JavaScript on a page can stop execution of all the JavaScript, so try fixing that one first.

Looking at mesonet-map-check-versions.php shows you have a current set of scripts (albeit missing some of the language support files, but since you’re using English only, that’s not an issue).

Running check-fetch-times.php?show=versions shows you have a really old version of that tool (it doesn’t display versions). I suggest you download https://saratoga-weather.org/wxtemplates/Test/check-fetch-times.php?sce=view , install on your site, then run check-fetch-times.php?show=versions to see what other support scripts may need updating.

I hope this helps…

Best regards,
Ken

Hi there Ken,

Many thanks for your rapid reply. I made the correction you spotted in the ajaxWDwx-settings.js file but it didn’t seem to make any difference.
However running the latest version of check-fetch-times.php?show=view indicates that my website needs an enormous amount doing to it mainly in updating out of date files but also quite a few were missing. In my current system there are quite a few changes from the original Saratoga system to allow data from unusual hardware to be displayed.

Presumably you can run “check-fetch-times.php?show=view” on my website and you will see what I have seen. Not sure if I have the energy to make all the changes and I’d be worried that some self made changes might no longer work. So I’m not quite sure where this leaves me. Perhaps I should just update one file at a time until we find the culprit but it looks as though the system has changed vastly since the time of my original set-up. I guess I knew that but didn’t realise it was so critical for this particular application.

Many thanks again,

John

Hi John,
It looks like you have an original V2 of the AJAX-WD-World template set, so unless you update to a V3 Base-World/WD-plugin set, the check-fetch-times.php?show=versions may not be very helpful. You can get a complete set of the needed files to convert V2 to V3 by using the V2->V3 conversion tool – it’s a fairly exacting process to merge your mods into the new files, but afterwards, you’ll be able to easily use the update tool to keep the common scripts fresh and tidy.

But… more to your issues cited in the first post:

  1. The Settings.php entries are being ignored
   143:	$SITE['rmMapUseDefaults'] = 'false';
   144:	$SITE['rmNETID'] = 'SCWN';
   145:	$SITE['rmMapZoom'] = '6';
   146:	$SITE['rmMapCenter'] = '56.0, -4.0';

should be

   143:	$SITE['rmMapUseDefaults'] = false;
   144:	$SITE['rmNETID'] = 'SCWN';
   145:	$SITE['rmMapZoom'] = '6';
   146:	$SITE['rmMapCenter'] = '56.0,-4.0';

note that ‘false’ is not the same as false in PHP. The former is a string and in a logical compare evaluates as true (that is non-zero), while the latter is a logical constant and evaluates as false (a zero). That’s likely the reason why your override settings were ignored.

  1. the rotating conditions seem to skip values. This strange behavior is caused by two instances of
setTimeout("RMNET_rotate_content()",RMNETrotatedelay);

being run with slightly different start times. That routine should run once after the page is loaded to begin the rotations of the display (and on your page it seems to be running two instances).
I noticed that a ‘Pause’ and then a ‘Run’ gets it back to doing an orderly transit of the rotating conditions with no ‘skips’. I’ll have to dig into your code a bit more to isolate the cause.

  1. regarding the clientraw.txt location, that’s not something that the mesonet-map scripts use directly – the data for the mesonet-map comes directly from the selected regional network (SCWN in your case), and the SCWN is doing the ‘pull’ of your clientraw.txt every 5 minutes. If the location of the conditions file is incorrect on the SCWN, that’s something that Martin at SCWN to correct. Currently, the SCWN is showing
    Details for Angus Auchterhouse (SCWN-stations-cc.txt record 27):
so it is pulling from ./clientraw.txt and not ./live/clientraw.txt so contact Martin to make that change.

Hope this helps…

Best regards,
Ken

Hi Ken,

OK the initial conditions (zoom and position)problem (my stupidity) and the clientraw.txt source problem have been solved. I will try to contact Martin in due course. But the other one persists. I notice that the line
setTimeout(“RMNET_rotate_content()”,RMNETrotatedelay);
exists in mesonet-map.js. Now when I try to look at that file with my editor, it comes up with some errors (doesn’t specify what they are) so perhaps I have a corrupted file there?
I couldn’t find another instance of that line in other code but that doesn’t prove anything as there are many files to choose from! I don’t know if that information is of any help.

Thank you again for being so helpful.

Regards,
John

Hi Ken,

I’m not clear whether you are still working on my problem of the parameters not rotating correctly on my SCWN weather page? It is possible that it is causing you some difficulty, in which case disregard this message. I would be grateful for an update on whether you can see your way to fix it.
Martin says he will be back tomorrow and hopefully, he will change the directory from which the clientraw.txt is read to the correct one.
I’m afraid fixing the parameter rotation problem is one for an expert!

John

Hi John,

Sorry for the delay in reply.

I think I have located the problem – there are two ‘initialize()’ JavaScript functions in the page. One in ajaxwdwx.js and one generated by the mesonet-map.

I suggest you change the ajaxwdwx.js script in two places:

function initialize() {

to

function initializeAJAX() {

and

   initialize();

to

   initializeAJAX();

then there won’t be interference, and the conditions rotation on the map will work one step at a time as intended.

Hi Ken,

I’m afraid that I couldn’t find any ‘function initialize()’ in my copy of ajaxwdwx.js. I couldn’t even find the word “initialize”. This suggests that it is an older copy? Perhaps that function was initiated in a different way then. On looking at my files, I found under a directory labelled Ajax another copy of ajaxwdwx.js which does contain the ‘function initialize()’. A friend of mine who lives in London is responsible for some changes and I think he found the latest version (several years ago) did not work with what he was trying to do.

So I suspect the version I am using is older (2009) than the one you thought I was using. I guess this all points to the requirement that I bring my system up to date. Not sure what to do now.
John

Hi John,
The file is at http://sidlawweather.co.uk/ajaxwdwx.js – and it has the two instances of initialize( in it. That’s the one to edit to change it to initializeAJAX( for both occurrences.

Hi Ken,

When I looked for the problem, I stupidly assumed that the copy of ajaxwdwx.js I had in a certain location on my system was the same as the one on my website. But of course it wasn’t, sorry about that. So I found out which one it was, found the ‘function initialize()’ , edited it precisely as you described and posted it to my website, but, I regret to say that it hasn’t made any difference. What a pity!

John

Hi John,
I just checked, and you have successfully modified the ajaxwdwx.js file to replace the two instances of ‘initialize(’ with ‘initializeAJAX(’.
Looking at your SCWN map, it is now working correctly for me – no skipping ahead with the rotating conditions display as had been previously happening.

Please try viewing the http://sidlawweather.co.uk/wxmesonetmap.php page again, and do a shift-reload to refresh the browser cache – then it should display correctly for you.

Best regards,
Ken

Hi Ken,

Yes, we have a fix!!! Thank you very much! It works fine now.

Kind regards,

John

You’re welcome, John. Glad it was an easy fix once isolated – JavaScript errors can be a real pain to diagnose sometimes.

Best regards,
Ken