How can i periodically load the XML file into the map page

217 views
Skip to first unread message

Chathura Gunasekara

unread,
Nov 23, 2010, 2:45:34 AM11/23/10
to google-map...@googlegroups.com
My xml file updates with the changes to the data base how can I update the map when the xml changes. I am following the articles http://code.google.com/apis/maps/articles/phpsqlajax_v3.html
can any one please help me .

Rossko

unread,
Nov 23, 2010, 3:53:12 AM11/23/10
to Google Maps JavaScript API v3
To answer the thread title
"How can i periodically load the XML file into the map page"
use javascript
http://www.w3schools.com/js/js_timing.asp

but for
> My xml file updates with the changes to the data base how can I update
> the map when the xml changes.
you don't have a way of informing the map client that the database has
changed, so you will have to do as above instead and periodically
check from the client end.

CroNiX

unread,
Nov 23, 2010, 3:54:20 AM11/23/10
to Google Maps JavaScript API v3
Sounds like a job for ajax.

On Nov 22, 11:45 pm, Chathura Gunasekara <chath...@gmail.com> wrote:
> My xml file updates with the changes to the data base how can I update
> the map when the xml changes. I am following the articleshttp://code.google.com/apis/maps/articles/phpsqlajax_v3.html

Chathura Gunasekara

unread,
Nov 23, 2010, 4:11:17 AM11/23/10
to google-map...@googlegroups.com
i need a function to update the map from taking data repeatedly from xml file, i tried

setInterval(repeat,5000);

function repeat(){
generate_xml.php
}


but it takes the old xml data from memory and display that. How can i write a function for that? my javascript knowlegde sucks , so can any one help me?

Rossko

unread,
Nov 23, 2010, 4:33:19 AM11/23/10
to Google Maps JavaScript API v3
> but it takes the old xml data from memory and display that.

So you use cache-busting techniques; the simplest is to add some
random dummy parameter to your URL, based on the time usually.

Chathura J Gunasekara

unread,
Nov 23, 2010, 5:23:23 AM11/23/10
to google-map...@googlegroups.com
hi,
this is wht i tried but ddnt work, still the same old xml is displayed
downloadUrl("phpsqlajax_genxml3.php?"+Math.random(), function(data) {

Chathura Gunasekara

unread,
Nov 23, 2010, 5:26:29 AM11/23/10
to google-map...@googlegroups.com
i tried this but didnt work
downloadUrl("phpsqlajax_genxml3.php?"+Math.random(), function(data) {

Andrew Leach

unread,
Nov 23, 2010, 5:27:07 AM11/23/10
to google-map...@googlegroups.com

Time for a link then. That sort of thing should work.

Rossko

unread,
Nov 23, 2010, 6:34:27 AM11/23/10
to Google Maps JavaScript API v3
> i tried this but didnt work
> downloadUrl("phpsqlajax_genxml3.php?"+Math.random(), function(data) {

Well it's not in the usual kay/value form, that might stop it working.
url.com/blah.php?someparam=random
Reply all
Reply to author
Forward
0 new messages