Kml layers doesn't update when reloading the page

…衆ロ難τιáo~ 提交于 2019-12-01 16:59:58

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();

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);

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!