[OpenLayers-Dev] reassigning map view question

Eric Lemoine eric.lemoine at camptocamp.com
Mon Jul 13 11:39:06 EDT 2009


On Monday, July 13, 2009, mikani <gina.m.dang at lmco.com> wrote:
>
> Hi,
>
> I'm trying to reset the map to a current viewport by getting the extent from
> current view, and setting the zoomextent to the previous extent, and it's
> not working correctly for me.
> Is this a correct way to do so?  If not, what do I need to call in order to
> reset the map to previous state?
>
> Sample code:
>
> ...
> var boundbox = map.getExtent().toBBOX());
> ...
>
> After:
> ...
> map.zoomToExtent(new OpenLayers.Bounds(boundbox));

How about

var bounds = map.getExtent();
map.zoomToExtent(bounds);

?

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 Dev mailing list