[OpenLayers-Users] What is the relationship between zoom level and longitude/latitude

Fabian Patzke patzke at geoinformationsdienst.de
Fri Aug 7 06:32:55 EDT 2009


Adrian Popa <adrian_gh.popa at ...> writes:

> 
> Hello everybody.
> 
> I'm trying to zoom to view an area for which I have the minimum and 
> maximum longitude/latitude. Basically I would like to zoom in to see a 
> rectangle with known coordinates. I already calculated the center of 
> this rectangle - so that's not a problem - the map centers beautifully 
> to that.

Don't try it the hard way :)
Take the zoomToExtent() function an 

var zoomExtent = new OpenLayers.Bounds(left, bottom, right, top);
map.zoomToExtent(zoomExtent);

maybe you need to transform zommExtent first.

I hope that helps.
Greetings,
Fabian






More information about the Users mailing list