You're showing and hiding markers, but the gmarkers array that you're
using to calculate the bounds always has the same content, regardless
of whether markers are visible or not.

Also, you have a lot of entries with lat/lon (0,0):
http://otb.vw01.starsale.nl/bin/Modules/VWGM/elementsDataXml.jsp
so there's always some markers off the coast of Africa which extend
your bounds.

I'd suggest creating a separate array of markers for each checkbox, or
a 2-dimentional array, like markers[checkboxIndex][markerIndex]

--
Marcelo - http://maps.forum.nu
--




On Oct 14, 2:49 pm, Umut Tuncdemir <[email protected]> wrote:
> Hello all,
>
> I have more or less map similar with below example.Only in my case
> each checkbox is showing/hiding a group of markers not single as in
> the below example.
>
> http://www.geocodezip.com/v2_MarkerCheckBoxes.asp
>
> My problem is after each click on any of the checkbox i invoke a
> function which should center the map according to visible markers and
> set best zoom level for all of them..
>
> my function is :
>
> function VWGM_AutoPositionAndZoom(){
>
>         var bounds = new GLatLngBounds();
>
>         for (var i = 0; i < gmarkers.length; i++) {
>                  var point = gmarkers[i].getPoint();
>
>                  bounds.extend(point);
>         }
>
>         map.setZoom(map.getBoundsZoomLevel(bounds));
>         map.setCenter(bounds.getCenter());
>
> }
>
> But this function only sets zoom level 2 in all cases (default zoom
> level is 7) and set the position always somewhere in the middle that
> makes view all markers at a once look.But what i am in need of is not
> this actually, i want auto zoom in for example in case only two
> markers visible on map then i expect to get zoomed only on these
> markers closely with centralized position.
>
> I have researched enough and tried many things but in all ways i got
> the same result which is a map zoom level set to 2 in all cases and
> makes the view on markers very far neverthless how many markers and
> where their positions are..
>
> And my own case is on below link:
>
> http://otb.vw01.starsale.nl/bin/ibp.jsp?ibpDispWhat=zone&ibpPage=S1_F...
>
> Hope you understand what i meant.
>
> Any help will be much appreciated.
>
> Thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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