[OpenLayers-Users] zoom to feature

Phil Scadden p.scadden at gns.cri.nz
Mon Oct 24 16:34:49 EDT 2011


>
> Is there any way to do a Zoom to an filtered feature via CQL query?
Are you filtering via WFS? What I do, is that when I make a WFS call and 
get back some features, then I find the boundingbox on the returned 
features as I process the WFS return. Then if the user pushes a "zoom to 
selection" button, I do a zoomToExtent on that bounding box.
eg
                 var fts = request.features;
                 sExt = fts[0].geometry.getBounds().clone();
                 for(var i=1;i<fts.length;i++)
                     sExt.extend(fts[i].geometry.getBounds());
...
map.zoomToExtent(sExt)

Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.



More information about the Users mailing list