[OpenLayers-Dev] setting tile size

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Wed Nov 8 04:43:34 EST 2006


Hi Duarte,

OpenLayers creates a buffer (default value of 2 rows/columns) of tiles
around the map image, you can influence this using:

When creating a layer, add a 'buffer' option, and set it to '1':

  Layer('WMS', 'http://url', {'map':'foo'}, {'buffer':1}); 

You can set the size of mapping using css:

        #map {
            width: 768px;
            height: 512px;
        }

which corresponds in my case to:
<div id="map">

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl


--------- Oorspronkelijk bericht --------
Van: Duarte Carreira <DCarreira at edia.pt>
Naar: Bart van den Eijnden OSGIS <bartvde at osgis.nl>
Cc: dev at openlayers.org
Onderwerp: RE: [OpenLayers-Dev] setting tile size
Datum: 08/11/06 07:37

> Bart,
> 
> Thanks. 
> 
> Also about setting the size of the map and number of tiles. Is this
possible? How does OpenLayers calculate the number of tiles?
> 
> Duarte 
> 
> -----Mensagem original-----
> De: Bart van den Eijnden (OSGIS) [mailto:bartvde at osgis.nl] 
> Enviada: terça-feira, 7 de Novembro de 2006 21:01
> Para: Duarte Carreira
> Cc: dev at openlayers.org
> Assunto: Re: [OpenLayers-Dev] setting tile size
> 
> Hi,
> 
> When creating the map or layer, add a tileSize option:
> 
>   Map('map', {'tileSize': new OpenLayers.Size(512,512)});
> 
> Best regards,
> Bart
> 
> Duarte Carreira schreef:
> &gt; How is it possible to set the tile size to a custom size?
> &gt;  
> &gt; Regardless of the map size the tile size is always 256x256.
> &gt; Does the map div set the map size? For instance, setting width and 
> &gt; height of the map div to 400x300 sets the size of the map object?
> &gt; When I try a 400x300 map I still download 29 tiles, each being 
> &gt; 256x256... which seems too much for such a small map.
> &gt;  
> &gt; Can anyone shed some light on this please?
> &gt;  
> &gt; Thanks,
> &gt; Duarte
> &gt;
----------------------------------------------------------------------
> &gt; --
> &gt;
> &gt; _______________________________________________
> &gt; Dev mailing list
> &gt; Dev at openlayers.org
> &gt; http://openlayers.org/mailman/listinfo/dev
> &gt;   
> 
> 
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> bartvde at osgis.nl
> http://www.osgis.nl
> 
> 
> 






More information about the Dev mailing list