Kml levels do not update when page reloads

[EDIT] it seems that the problem is with Google maps, which takes time to update the KML link ... I'm not sure, but in the end it works ... [/ EDIT]

I posted an existing google public map on this website: http://www.ridetheflavour.fr

Here is the shared map link: https://maps.google.fr/maps/ms?msa=0&msid=211027213468691902621.0004c8616605648d245b2

As you can see, the embedded site map markers do not match the google public map markers. This doesn't seem to be a browser cache issue ...

Here is the javascript snippet I'm using (Google V3 Map API):

var mapOptions = { center: new google.maps.LatLng(24.797409,-5.449219), zoom: 3, mapTypeId: google.maps.MapTypeId.TERRAIN, overviewMapControl: false, streetViewControl: false }; var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); var georssLayer = new google.maps.KmlLayer('https://maps.google.fr/maps/ms?ie=UTF8&authuser=0&msa=0&output=kml&msid=211027213468691902621.0004c8616605648d245b2'); georssLayer.setMap(map); 

Any help would be greatly appreciated.

+7
source share
2 answers

Google servers cache KML content for a period of time. To force updated KML to update, add the cache override option to the URL. Usually I use the date / time function, if I need to do this programmatically, or if it is only once, edit the manual? A = 0 and increase it when I make changes.

Something like this (unless you have other request parameters in the url):

  var URL = filename+"?dummy="+(new Date()).getTime(); 
+17
source

Or you can simplify it even more and use:

var URL = '[your URL kml] & ver =' + Date.now ();

var georssLayer = new google.maps.KmlLayer (URL);

0
source

All Articles