[OpenLayers-Users] Can I make the map cover the whole viewport

Christopher Schmidt crschmidt at metacarta.com
Tue Jan 23 18:45:33 EST 2007


On Tue, Jan 23, 2007 at 03:27:43PM -0800, Andrew George wrote:
> Hi,
> I have to fill the whole viewport with the map. I don't mind panning if
> necessary to view the whole map, but Iam required not to show any empty area
> around the map. So everytime the user increases the viewport size, I need to
> zoom my map automatically so that it covers the entire viewport. How can I
> achieve this?

There is no way to do this in the current OpenLayers code.

maxResolution: 'auto' will fill the viewport with the map when the
viewport is first filled. If you zoom in once from this, the user will
need to double the size of the viewport in order to be outside the
viewable area. However, the user can still just zoom out and view
non-map area outside the viewport.

There is an open ticket for wrapping the world: this wuold help on the
sides of the map, but wouldn't help at the top and bottom.

What you need is a way to dyanmically change the resolutions of the map.
It's possible that changing the resolutions of the layers via a map
handler would work, but it's definitely not tested and not supported,
and I wouldn't be surprised to find out that things depend on the map
resolutions not changing.  

If you want this functionality, you'll probably have to do some hacking
with resize events. Good luck. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list