[ka-Map-users] dynamic xml overlay?
Lorenzo Becchi
lorenzo at ominiverdi.com
Wed Sep 10 08:38:31 EDT 2008
Deli, please remember to reply to the list too.
probably the problem is related to the cache of your xml_points.php
try to put something like this for header:
|<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>
or check the page of PHP manual for Header
|
http://www.php.net/header
another quick and dirty solution is to add a random number to your url
each time you call xml_points.php so the browser will not use the cache
because of the url changed.
var r = /Math.rand/();
myInterval =
setInterval("myXmlOverlay.loadXml('xml_points.php?r=' + r )",10000);
ciao
Lorenzo
Deli Soetiawan wrote:
> already tried it, i decided it has to reload data every 1 minute, but
> now there's another problem (again), i use <icon></icon> as overlay
> presentation (instead of <symbol></symbol>) and when the page reload
> the data (fetch from server) the icon were gone (i use png file
> format) and the label still there (in 1st place, not updated place),
> also i tried to remove some of points, and the label for the old
> (removed) point still there
>
> i guess it deals with browser cache since when i push refresh/reload
> button it went OK, any suggestion?
>
> here the code (i modified "iframe_XMLOverlay_point.html"):
> var canvas = null;
> function printMyOverlay () {
> myXmlOverlay = new kaXmlOverlay( myKaMap, 250 );
> myXmlOverlay.loadXml('points.xml');
> myInterval =
> setInterval("myXmlOverlay.loadXml('xml_points.php')",10000);
> }
>
> On Wed, 10 Sep 2008 17:36:09 +0700, Lorenzo Becchi
> <lorenzo at ominiverdi.com> wrote:
>
>> Hi Deli,
>>
>> Deli Soetiawan wrote:
>>> hi there,
>>>
>>> still new with WebGis and KaMap, i've tried XML Overlay demo and it
>>> works well, i plan to create something like vehicle tracking using
>>> KaXMLOverlay for my college works. the concept was to move car icon
>>> on XML generated data every 1 minute,
>>> however i need to know how dynamically load data works using this
>>> xml overlay?
>>>
>>> i've read :
>>> http://ka-map.ominiverdi.org/wiki/index.php/Overlay_API_Reference
>>> and found code:
>>> myInterval = setInterval("myMovingOverlay.loadXml('xmlget.php')",5000);
>>>
>>> did it refresh the xml result from xmlget.php every 5 seconds (5000
>>> miliseconds)?
>>
>> it should
>>
>>> i mean did it really refresh the data (say if there an update every
>>> 2 seconds)?
>>
>> it should relead the data. Every two seconds, IMO, is not a good
>> interval, it's too short. Many times net congestions can arise the
>> number of contemporary calls on the server and create problems.
>>
>>
>> ciao
>> Lorenzo
>>
>>
>>
>>
>>
>>
>>
>>> since i really concerned about data refresh
>>>
>>> and what the different if i use this js:
>>> var myInterval =
>>> setTimeout("myMovingOverlay.loadXml('xmlget.php')",5000);
>>>
>
>
>
More information about the ka-Map-users
mailing list