Hi,

I thought this would be kind of simple, but no.

I'm trying to get the map to pan and zoom according to the markers
that are shown after conducting a search.

So I figured that:

function centerZoom() {
for (var j = 0; j < gmarkers.length; j++) {
 var bounds = new google.maps.LatLngBounds();
    if (!gmarkers[j].isHidden()) {
      var point = gmarkers[j].getPoint();
      bounds.extend(point);
    }
 map.setZoom(map.getBoundsZoomLevel(bounds));
        map.setCenter(bounds.getCenter());
                 }
        }

called by

    for (var j = 0; j < gmarkers.length; j++)
    {

        var str=gmarkers[j].myname.toLowerCase();
        var patt1=inp;
        if (str.match(patt1))
        {
            found = true;
gmarkers[j].show();
        centerZoom();
}

would do the trick, but no - I get a "centerZoom is undefined" error.
The search function works fine, it's just the centerZoom that's giving
me trouble. the map is here:
http://www.xelawho.com/map/twocolumn3.htm

(to reproduce the error type "bla" into the search box top left)

... any ideas?

thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to