[OpenLayers-Users] Zoom levels

Christopher Schmidt crschmidt at metacarta.com
Fri Mar 9 09:47:07 EST 2007


On Fri, Mar 09, 2007 at 08:21:16AM -0600, Tim Langlois wrote:
> I am doing the same thing.  I did not see any direct support for this in
> OpenLayers, so I implemented this by setting minBottom, minLeft, maxTop
> maxRight variables as I loop through the icons I wish to display.  If
> the lon,lats of the icon are greater/lesser than one of those variables,
> I update the appropriate variable using the coordinates of the icon. At
> the end of the loop, I do this:
> 
> var bounds = new OpenLayers.Bounds(minLeft,minBottom,maxRight,maxTop);
> map.setCenter(bounds.getCenterLonLat(),map.getZoomForExtent(bounds));

Extending a bounds by either a bounds or a point has been added to the
vector-2.4 branch, and is therefore likely to exist in 2.4. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list