ESRI.ArcGIS Map加载动态KML
问题描述:
我正在加载ESRI地图和KML层一切正常!ESRI.ArcGIS Map加载动态KML
问题:在KML数据更改(经常更改)后,我无法在地图中显示新更改。我需要强制 每次清除浏览器缓存。我尝试刷新该层没有工作。
我的代码
// Create a new KmlLayer object.
ESRI.ArcGIS.Client.Toolkit.DataSources.KmlLayer theKmlLayer = new ESRI.ArcGIS.Client.Toolkit.DataSources.KmlLayer();
// Set the KmlLayer's ID.
theKmlLayer.ID = "SampleData";
// Set the Url of the KmlLayer. Note the Url takes a Uri object!
theKmlLayer.Url = new Uri("localhost/KML/east.kml");//Here is the New KML Data
// Need to use a ProxyUrl on the KmlLayer since the service is not hosted locally or on a local network.
theKmlLayer.ProxyUrl = "http://serverapps.esri.com/SilverlightDemos/ProxyPage/proxy.ashx";
// Add the KmlLayer to the Map. An automaic refresh of the Map and Legend Controls will occur.
Map1.Layers.Add(theKmlLayer);
我试图theKmlLayer.Refresh();
我需要通过代码清除浏览器缓存还是可以加载新的数据?
答
KML缓存的常用解决方案(以及Google在服务器上缓存数据数小时)是在URL中使用随机或基于时间的缓存清除参数(因此它永远不会相同)。快取破坏参数的
一个例子:
'?dummy=' + (new Date()).getTime());
是它做的伎俩。 – subZero