[Users] Zoom to Multiselect

David E. Reksten der at dod.no
Tue Oct 26 12:38:27 CEST 2010


Hi,

not sure if I understand your question correctly, but if you want to
zoom to the accumulated bounding box of all/several features on a
layer, this should point you in the right direction:

    // Zoom to bounds of all features on layer
    var bounds;
    features = myVectorLayer.features;
    if (features) {
        if(features.constructor != Array) {
            features = [features];
        }
        for(var i=0; i<features.length; ++i) {
            if (!bounds) {
                bounds = features[i].geometry.getBounds();
            } else {
                bounds.extend(features[i].geometry.getBounds());
            }

        }
        if (bounds) {
            map.zoomToExtent(bounds);
        };

Regards,
.david


2010/10/26 Robert Buckley <robertdbuckley at yahoo.com>:
> Hi,is it possible to zooom onto the bounds of mulitselected features?  I have a
> button which zooms to a selected feature in a grid, but It would be nice to
> enable it to work for mulit select grids? I don´t know how this would be enabled
>
> though...is this possible?
>
>
> yours  Robert Buckley
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>


More information about the Users mailing list