I have a problem with the loading of kml files via the GGeoXml class. Essentially I have a web page with a Google Map, a GGeoXml layer (accessing web address "http://randhost.edu/file.kml") and one button "refresh". When the "refresh" button is clicked, a cgi script is called which generates a new kml file at the address "http:// randhost.edu/file.kml". The user is then redirected to the map page and the new kml data should be loaded with the GGeoXml layer. Now this works perfect for the first click on button "refresh", but subsequent calls yield the same data in the GGeoXML layer, although the content in the kml file at address "http://randhost.edu/file.kml" has changed.
After (some long) troubleshooting, I found out that this behavior seems not to be caused by my programming, but by the way how Google Maps handles kml links. I tried the following: I went to maps.google.com and entered a web link to a kml file - "http:// randhost.edu/someKMLFile.kml". As expected the placemark contained in this file gets displayed. When I now delete the file "someKMLFile.kml" and click on the "search" button again, the site is refreshed and the placemark still gets displayed, although the kml link that I am opening does not exist anymore! It takes approximately 4 minutes until the message "File not found at http://randhost.edu/someKMLFile.kml" shows up. During these 4 minutes however I still can access the non existent web link.
My guess is now that Google caches these kml links and stores their content somewhere. When the file under the kml link changes this will be ignored by Google and only after some specified amount of time Google reloads the kml link into its cache. Are these assumptions correct and has anyone else experienced problems with this behavior? Is it possible to disable this caching behavior and force Google to access the original kml link whenever a new request to the link is issued?
A simple way round it is to add a random paramater to the URL, your server will just ignore it, but Google sees it as a different url, so has no option but to fetch it again.
> I have a problem with the loading of kml files via the GGeoXml class. > Essentially I have a web page with a Google Map, a GGeoXml layer > (accessing web address "http://randhost.edu/file.kml") and one button > "refresh". When the "refresh" button is clicked, a cgi script is > called which generates a new kml file at the address "http:// > randhost.edu/file.kml". The user is then redirected to the map page > and the new kml data should be loaded with the GGeoXml layer. Now this > works perfect for the first click on button "refresh", but subsequent > calls yield the same data in the GGeoXML layer, although the content > in the kml file at address "http://randhost.edu/file.kml" has changed.
> After (some long) troubleshooting, I found out that this behavior > seems not to be caused by my programming, but by the way how Google > Maps handles kml links. I tried the following: I went to > maps.google.com and entered a web link to a kml file - "http:// > randhost.edu/someKMLFile.kml". As expected the placemark contained in > this file gets displayed. When I now delete the file "someKMLFile.kml" > and click on the "search" button again, the site is refreshed and the > placemark still gets displayed, although the kml link that I am > opening does not exist anymore! It takes approximately 4 minutes until > the message "File not found at http://randhost.edu/someKMLFile.kml" > shows up. During these 4 minutes however I still can access the non > existent web link.
> My guess is now that Google caches these kml links and stores their > content somewhere. When the file under the kml link changes this will > be ignored by Google and only after some specified amount of time > Google reloads the kml link into its cache. Are these assumptions > correct and has anyone else experienced problems with this behavior? > Is it possible to disable this caching behavior and force Google to > access the original kml link whenever a new request to the link is > issued?
Thanks for the reply, this solution works perfectly!
Does anyone know why they do not check if there is new data available before they provide outdated data? And why are such exceptions not mentioned in the API, if I want to access a file via the GGeoXml class then I want it to be exactly that file and not a magically cached old version of the same file.
Most browsers will ignore changes when the URL doesn't change. On FF and NS (maybe others), you can hit shift-reload and it will check. Don't know if there's a way to do that from JS. I use the hash portion of the URL to record my internal state changes (and to allow me to go back with the back button), but if I don't change the URL, nothing happens.
I just thought that's the way it works Without caching, things would grind to a halt. <grin>.
On Jun 15, 3:02 pm, iS <ingo.sei...@gmx.at> wrote:
> Thanks for the reply, this solution works perfectly!
> Does anyone know why they do not check if there is new data available > before > they provide outdated data? And why are such exceptions not mentioned > in the > API, if I want to access a file via the GGeoXml class then I want it > to be exactly > that file and not a magically cached old version of the same file.