How does the Google Maps API refesh the .kml?

11 views
Skip to first unread message

DaveS

unread,
Jul 19, 2007, 5:14:40 PM7/19/07
to KML Developer Support - Getting Started
I'm building a weather app that will eventually live here: www.cbc.ca/bc

And I expect the weather reports to update a few times a day, with
maybe 10,000 hits a day as well.

Experimenting with the Google Maps API, I find that when I update
the .kml it will sometimes take a looooong time for this to be
reflected in my map.

(my test is here: http://www.restohof.com/map/bc.html )

I tried using NetworkLink with refreshInterval set to 1 second but it
still wasn't really refreshing every 1 second in my map. I can only
assume the API caches my kml?

This doesn't need to update every second, but I'd like the changes
made to the kml to appear on the map as soon as I can get them.

Is there some other method I'm missing? Should I forget about
refreshInterval altogether?

barryhunter

unread,
Jul 19, 2007, 5:37:28 PM7/19/07
to KML Developer Support - Getting Started
Google Maps (and GGeoXML), does not support refreshing Network Links
at all, they will load once during loading and that's it.

The exact interval of refreshing is unclear, but they are certainly
cached. So even pressing F5 will not fetch the latest data.

You can force it to refresh by using a arbitrary parameter that
changes regularly (eg bc.kml?rand=23434), you will also need to code
the auto 'refresh' using javascript. However beware you will have to
make sure that your server returns the correct mimetype*, otherwise
Googles server might miss that its a KML, as it can no longer see the
extension.

There is rumours that GE honours Expires http headers, but have no
experience myself, its possible they are honoured my the Maps parser
server? (its been hinted at)


* which you dont currently,
http://groups.google.com/group/Google-Maps-API/web/more-info-kml-on-google-maps

DaveS

unread,
Jul 20, 2007, 10:50:14 AM7/20/07
to KML Developer Support - Getting Started
Thanks a lot for this thorough answer, Barry. I will experiment with
some of these ideas.

Out of curiosity, how do you know that my server is serving the wrong
MIME type?

barryhunter

unread,
Jul 20, 2007, 8:09:04 PM7/20/07
to KML Developer Support - Getting Started
This is probably the easiest way:
http://www.rexswain.com/httpview.html


(but I use the Firefox Extension LiveHttpHeaders regually - it adds a
VERY useful tab to the page info dialog)

DaveS

unread,
Jul 24, 2007, 12:18:23 PM7/24/07
to KML Developer Support - Getting Started
Thanks again Barry. That Firefox extension is very useful.

Reply all
Reply to author
Forward
0 new messages