stoimen
stoimen

Reputation: 564

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.

Upvotes: 1

Views: 1688

Answers (3)

Fernando
Fernando

Reputation: 11

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

Just use a local single, tiny, transparent png tile.

Upvotes: 1

Conley Owens
Conley Owens

Reputation: 9163

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.

Upvotes: 1

milovanderlinden
milovanderlinden

Reputation: 1194

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>

Upvotes: 1

Related Questions