[OpenLayers-Users] Is there an easy way to center and zoom the map automatically based on the placemarks that are on it?

Phil Scadden p.scadden at gns.cri.nz
Sun Jul 8 14:05:10 PDT 2012


Something like this?  (okay, I do this on a WFS request, rather than a 
layer but principle should apply.

           var fts = layer.features;
           if (fts.length>0 && fts[0].geometry) {
               sExt = fts[0].geometry.getBounds().clone();
               for(var i=1;i<fts.length;i++) {
                  sExt.extend(fts[i].geometry.getBounds());
               }
           }


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