[OpenLayers-Users] Zoom to selected features

Arnd Wippermann arnd.wippermann at web.de
Fri Apr 17 06:29:40 EDT 2009


Hi,
 
var fts = vectorlayer.selectedFeatures;
 
var bounds = fts[0].geometry.getBounds().clone();
 
for(var i=1;i<fts.length;i++)
    bounds.extend(fts[i].geometry.getBounds());

map.zoomToExtent(bounds,false);

this should work.
 
Arnd

  _____  

Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Antonio Jose Silva (Toze)
Gesendet: Donnerstag, 16. April 2009 23:22
An: users at openlayers.org
Betreff: [OpenLayers-Users] Zoom to selected features



Hi,

 

I´m a newbie in openlayers and I’m trying to do a service with a map, where
I make a selection and after that I want to zoom in to the selected feature.

How can I make it, any help?

 

Thank you in advance,

Toze

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090417/d6b102c4/attachment.html


More information about the Users mailing list