Kml layers doesn't update when reloading the page

后端 未结 2 1306
心在旅途
心在旅途 2021-01-17 22:43

[EDIT] it seems the problem comes from google maps which takes some time to update the KML link...I\'m not sure, but in the end, it works...[/EDIT]

I embedded an exi

相关标签:
2条回答
  • 2021-01-17 23:33

    Or you can simplify it even further and use:

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

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

    0 讨论(0)
  • 2021-01-17 23:34

    Google's servers cache the KML content for some period of time. To force the rendered KML to update, add a cache busting parameter to the URL. I usually use a function of the date/time if I need to do it programmatically, or if it is just a one time edit a manual ?a=0 and incrementing that as I make changes works.

    Something like this (if you don't have any other query parameters in the URL):

     var URL = filename+"?dummy="+(new Date()).getTime();
    
    0 讨论(0)
提交回复
热议问题