2012-05-29 38 views
2

我在我的學術項目中使用谷歌地圖,從幾周以後就會在地圖上顯示一條消息,只要我在地圖上執行某些操作(如放大,縮小)即可。原因?我需要在我的代碼中配置任何東西。 enter image description here在谷歌地圖上顯示一條消息

您可以在上圖中看到該消息,消息標題爲'地圖數據'。我們在項目中使用開放圖層地圖,編碼語言爲PHP。

回答

1

我在這裏讀到,其中一個原因可能是某些元素掩蓋了地圖數據的版權,但是我發現了一些關於彈出相同通知而沒有提到這一點的投訴。

我發現的最有前途的選項是a page saying the solution is to upgrade to 2.12或者,如果你不能,那麼包括OpenLayers.js

<script src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=false"></script> 
    <script src="../lib/OpenLayers.js"></script> 
    <script> 
    OpenLayers.Layer.Google.v3.repositionMapElements = function() { 
     // This is the first time any Google layer in this mapObject has been 
     // made visible. The mapObject needs to know the container size. 
     google.maps.event.trigger(this.mapObject, "resize"); 

     var div = this.mapObject.getDiv().firstChild; 
     if (!div || div.childNodes.length < 3) { 
      this.repositionTimer = window.setTimeout(
       OpenLayers.Function.bind(this.repositionMapElements, this), 
       250 
      ); 
      return false; 
     } 

     var cache = OpenLayers.Layer.Google.cache[this.map.id]; 
     var container = this.map.viewPortDiv; 

     // move the ToS and branding stuff up to the container div 
     // depends on value of zIndex, which is not robust 
     for (var i=div.children.length-1; i>=0; --i) { 
      if (div.children[i].style.zIndex == 1000001) { 
       var termsOfUse = div.children[i]; 
       container.appendChild(termsOfUse); 
       termsOfUse.style.zIndex = "1100"; 
       termsOfUse.style.bottom = ""; 
       termsOfUse.className = "olLayerGoogleCopyright olLayerGoogleV3"; 
       termsOfUse.style.display = ""; 
       cache.termsOfUse = termsOfUse; 
      } 
      if (div.children[i].style.zIndex == 1000000) { 
       var poweredBy = div.children[i]; 
       container.appendChild(poweredBy); 
       poweredBy.style.zIndex = "1100"; 
       poweredBy.style.bottom = ""; 
       poweredBy.className = "olLayerGooglePoweredBy olLayerGoogleV3 gmnoprint"; 
       poweredBy.style.display = ""; 
       cache.poweredBy = poweredBy; 
      } 
      if (div.children[i].style.zIndex == 10000002) { 
       container.appendChild(div.children[i]); 
      } 
     } 

     this.setGMapVisibility(this.visibility); 
    }; 
    </script> 
    <script src="google-v3.js"></script> 
+0

是後打補丁,這個問題的OpenLayers的最新版本中解決。 –

+0

感謝它的工作 –