簡體   English   中英

如何跳過OpenLayers中的圖塊加載?

[英]How can I skip the loading of the tiles in OpenLayers?

實際上,我只需要地圖的全部功能,而沒有圖塊,也不需要向服務器發送任何請求。 我可以以某種方式在初始加載時跳過它們嗎? 我可以設置任何默認參數嗎? 如果不是,我自己動手制作補丁,但不確定是否還沒有完成。

layer = new OpenLayers.Layer.OSM("Transparent","/img/1x1_transparent.png", {numZoomLevels: 19}, {isBaseLayer:true});

只需使用本地的單個微小透明png瓦片即可。

我在此處粘貼的代碼為openlayers接口提供了無法加載的虛擬層。 盡管我看不到您為什么要這樣做,但這確實顯示了一個空的OpenLayers映射窗口。

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>OpenLayers Standalone</title>
    <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
    <script type="text/javascript">
        var map, layer;
        function init(){
            map = new OpenLayers.Map( 'map' );
            layer = new OpenLayers.Layer.WMS( "dummy",
                    "",
                    {layers: 'basic'} );
            map.addLayer(layer);
            //map.zoomToMaxExtent();
        }
    </script>
  </head>

  <body onload="init()">
    <h1 id="title">Basic Single WMS Example</h1>
    <div id="map" style="width:250px;height:250px"></div>
    <div id="docs">
    </div>
  </body>
</html>

只需使用矢量圖層。

http://openlayers.org/dev/examples/snapping.html

您實際上是否必須給地圖添加一層? 我沒有嘗試這樣做。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM