简体   繁体   中英

How can I skip the loading of the tiles in OpenLayers?

Actually I need only the full functionality of the map but with no tiles and no requests to the server for them. Can I somehow skip them on the initial load? Is there any default parameter I can set? If not I'll make the patch myself but I'm not sure it's not done yet.

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

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

The code I pasted here gives you the openlayers interface with a dummy layer that cannot be loaded. Although I do not see why you would want this, this does show up an empty OpenLayers mapwindow.

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

Just use vector layers.

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

Do you actually even have to give the map a layer? I haven't tried doing that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM