[OpenLayers-Users] Zoom levels

Tim Langlois tlanglois at archetypecorp.com
Fri Mar 9 09:21:16 EST 2007


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));

Tim


On Fri, 2007-03-09 at 17:16 +1100, bradleyspencer wrote:
> I want to create a bunch of OL markers and automatically set the zoom
> level and map centre to se all the markers on the map. 
> 
>  
> 
> This can be done in Google Maps bounds.extend and then after the loop
> calculating the zoomlevel and centre of the bounds.
> 
>  
> 
> Is there an example of this based on OL? 
> 
>  
> 
> Cheers,
> 
>  
> 
> Brad Spencer
> 
> General Manager
> 
> CubeWerx Australia Pty Ltd
> 
> ABN: 37 115 163 285
> 
> Mob: +61 (0)404 841 131
> 
> Tel/Fax: +61 (0)2 9481 7024
> 
> mailto:brad at cubewerx.com.au
> 
> http://www.cubewerx.com.au
> 
>  
> 
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
-- 
Tim Langlois
Chief Software Architect
Archetype, Inc.

The information transmitted is the property of Archetype, Inc. and is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Statements and opinions expressed in this e-mail may not represent those of the company.  Any review, retransmission, dissemination and other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender immediately and delete the material from any computer. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, received late or incomplete, or could contain viruses. The sender therefore does not accept liability for any error or omission in the contents of this message, which arises as a result of e-mail transmission.




More information about the Users mailing list