2012-10-10 39 views
1

我正在加載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();

我需要通過代碼清除瀏覽器緩存還是可以加載新的數據?

回答

1

KML緩存的常用解決方案(以及Google在服務器上緩存數據數小時)是在URL中使用隨機或基於時間的緩存清除參數(因此它永遠不會相同)。快取破壞參數的

一個例子:

'?dummy=' + (new Date()).getTime()); 
+0

是它做的伎倆。 – subZero