[OpenLayers-Users] How to set map size?

Eric Lemoine eric.lemoine at camptocamp.com
Sun Apr 18 08:22:11 EDT 2010


On Wednesday, April 14, 2010, Dennis Janezic / TerraTransfer GmbH
<d.janezic at terratransfer.de> wrote:
> Hello at all,

Hi.

> there is a problem I could not really solve by myself, so it would be
> very nice if someone could give me a hint.
>
> If the question has already been posted, please excuse me. I have
> searched the internet, but i cannot find what I am exactly searching for...
>
> So what I want to know from you is how to resize the map. I am using the
> open layers map as child of an window component (it's an qooxdoo
> application). Resizing the window still resizes the map (visual), but
> when I call the "getSize()" - method, the old size of the map is
> returned. (Thats a little bit strange for my understanding...) The
> problem which results is that not all tiles are rendered when enlarging
> the window...
>
> I have figured out setting the size of the map manually is possible by
> calling
>      map.size.h = 300;

Don't do that, that will lead to issues.

>
> After calling this command, the "getSize()" method returns the new size
> (300), but it does not lead to a solution. When calling the
> "updateSize()" method, open layers compares "getCurrentSize()" and
> "getSize()" and replaces the new size (300) with the old one (still
> stored under "getCurrentSize()") once again and the tiles still aren't
> rendered?!?

map.updateSize is what should be called. And getCurrentSize, called by
updateSize, should return the new size. If that's not what you're
observing then there's an issue somewhere.

Cheers,


-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list