[Geomoose-users] Refresh Layers Automatically SOLVED

Jay Kapalczynski jkapalczynski at ci.maple-grove.mn.us
Mon Nov 17 13:34:38 EST 2008


Thanks Duck once again for your patience....steered me in the right direction

The below is refreshing a specific layer every 5 seconds...the reason for this is that the layer is being created from a MySQL server table that is being updated through an Access Front end...as the server table gets updated (accidents) the refresh on the layer creates a new one thus showing the dots appear and disappear...
This could be used for tracking vehicles as well....


Demo.xml:

<service name="refreshLayers3" title="Refresh Layer every 2 Seconds" type="internal" default="true" locked="true" command="setIntervalNow()" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>

<service name="refreshLayers4" title="Stop the refreshing" type="internal" default="true" locked="true" command="clearIntervalNow()" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>

=====================================================================================
Demo.html page: between the <head> ... </head>

<script type="text/javascript" src="lib/Start_Listening.js"></script>

=====================================================================================

Start_Listening.js page:

varTest = 0;

function setIntervalNow()
{
varTest = setInterval("setIntervalNow2()", 5000);
}

function setIntervalNow2()
{
Events.triggerEvent('refreshlayer', 'Database');
}

function clearIntervalNow()
{
clearInterval(varTest);
}








From: Dan Little [mailto:danlittle at yahoo.com]
Sent: Monday, November 17, 2008 10:23 AM
To: Jay Kapalczynski; geomoose-developers at lists.sourceforge.net; geomoose-users at lists.sourceforge.net
Subject: Re: [Geomoose-users] Refresh Layers Automatically

Jay,

I can solidly say that you're off by a  bit.

What you need to do in the command attribute is set it to call the function in StartListening.js, StartListening.js also needs to be included in your <head> ... </head> in the html page.

So, say you had a function called "foobar()" in Starting Listening.js, then the command attribute would be...

command="foobar()"

________________________________
From: Jay Kapalczynski <jkapalczynski at ci.maple-grove.mn.us>
To: "geomoose-developers at lists.sourceforge.net" <geomoose-developers at lists.sourceforge.net>; "geomoose-users at lists.sourceforge.net" <geomoose-users at lists.sourceforge.net>
Sent: Monday, November 17, 2008 10:07:11 AM
Subject: Re: [Geomoose-users] Refresh Layers Automatically
Anyone with any thoughts on why I cant even get to the StartListening Function in the StartListening.js page from this call?

<service name="refreshLayers2" title="Refresh Layer every 5 Seconds" type="internal" default="true" locked="true" command="Events.triggerEvent('StartListening', 'DO I NEED SOMETHING HERE')" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>

Thanks....


From: Jay Kapalczynski
Sent: Wednesday, November 12, 2008 11:09 AM
To: geomoose-developers at lists.sourceforge.net; geomoose-users at lists.sourceforge.net
Subject: RE: [Geomoose-users] Refresh Layers Automatically

Have been talking with Duck and this is where I am right now....thought maybe someone else out there might have a few thoughts....

I created two buttons....one that will start refreshing a layer every couple seconds, one that will stop the refreshing.
I created two js pages that will handle the code

Am I on the right path here?  Right now I cant even get to the Start_Listening.js page, so I know I am not doing something correct.


Demo.xml makes the calls to the js pages.
Js pages do the work....just not sure how to call the refreshlayer from js page


This works currently but I need it to repeat and refresh every few seconds

<service name="refreshLayers2" title="Refresh Layer" type="internal" default="true" locked="true" command="Events.triggerEvent('refreshlayer', 'Database')" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>


THanks

3 FILES:

MapleGrove.demo.xml

<service name="refreshLayers2" title="Refresh Layer every 5 Seconds" type="internal" default="true" locked="true" command="Events.triggerEvent('StartListening', 'DO I NEED SOMETHING HERE')" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>

<service name="refreshLayers3" title="Stop the refreshing" type="internal" default="true" locked="true" command="Events.triggerEvent('StopListening ', 'DO I NEED SOMETHING HERE')" icon="shared/images/toolbar/MapleGrove_Buttons/Reload.jpg" highlight="shared/images/toolbar/MapleGrove_Buttons/Pictometry.jpg"/>


StartListening.js

StartListening();
setInterval("setIntervalNow()", 5000);
function setIntervalNow()
{
// Call the  Events.triggerEvent('refreshlayer', 'Parcels');

alert('Hello');
}


Stop Listening.js

StopListening();
clearInterval("clearIntervalNow ()", 5000);
function clearIntervalNow ()
{
// clearInterval

                alert('Hello');
}



From: Dan Little [mailto:danlittle at yahoo.com]
Sent: Tuesday, November 11, 2008 9:25 AM
To: Jay Kapalczynski
Subject: Re: [Geomoose-users] Refresh Layers

Do a google search on setTimeout and setInterval, they aren't built-in to GeoMOOSE, they're native JS functions.

________________________________
From: Jay Kapalczynski <jkapalczynski at ci.maple-grove.mn.us>
To: Dan Little <danlittle at yahoo.com>
Sent: Monday, November 10, 2008 3:02:38 PM
Subject: RE: [Geomoose-users] Refresh Layers
I did a search in all the .js files, the main config, demos, and menu files and cant find a ...  function setTimeout ()

Any thoughts as to where they are?

I suppose then I can just call the function and run the refresh code against the settimeout and set interval code (somehow)

Will cross that bridge when I get to it.  For now just cant seem to find the functions....

VERY APPRECITED duck....

From: Dan Little [mailto:danlittle at yahoo.com]
Sent: Monday, November 10, 2008 2:44 PM
To: Jay Kapalczynski; geomoose-developers at lists.sourceforge.net; geomoose-users at lists.sourceforge.net
Subject: Re: [Geomoose-users] Refresh Layers

Jay,

You'll need to look into setTimeout or setInterval Javascript functions.  You'll then need to write a couple of wrapper functions and attach that to two different buttons (easy to do with a service).

________________________________
From: Jay Kapalczynski <jkapalczynski at ci.maple-grove.mn.us>
To: Dan Little <danlittle at yahoo.com>; "geomoose-developers at lists.sourceforge.net" <geomoose-developers at lists.sourceforge.net>; "geomoose-users at lists.sourceforge.net" <geomoose-users at lists.sourceforge.net>
Sent: Monday, November 10, 2008 2:28:16 PM
Subject: RE: [Geomoose-users] Refresh Layers
That works great....but I am trying to do something else.  Hoping you can point me in the correct direction.

Was trying to get my hands on the code and modify it in another file.  I want to click a button in the tool bar and it runs the refresh on a particular layer every 10 seconds (or some other specified time value)

So I would need a loop to run then stop when the another button was clicked.

Any thoughts?



From: Dan Little [mailto:danlittle at yahoo.com]
Sent: Monday, November 10, 2008 2:16 PM
To: Jay Kapalczynski; geomoose-developers at lists.sourceforge.net; geomoose-users at lists.sourceforge.net
Subject: Re: [Geomoose-users] Refresh Layers

Example:
One Layer - Events.triggerEvent('refreshlayer', 'Parcels');
All Layers - Events.triggerEvent('refreshlayers', '');

________________________________
From: Jay Kapalczynski <jkapalczynski at ci.maple-grove.mn.us>
To: "geomoose-developers at lists.sourceforge.net" <geomoose-developers at lists.sourceforge.net>; "geomoose-users at lists.sourceforge.net" <geomoose-users at lists.sourceforge.net>
Sent: Monday, November 10, 2008 2:09:48 PM
Subject: [Geomoose-users] Refresh Layers
Where is the function that refreshes the layers?

Anyone out there know how I could configure the code the refresh a specific layer?

Thanks







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20081117/16aaf11d/attachment.html


More information about the Geomoose-users mailing list