I have found out how to remove marker from the map but now when i try
to recreate the marker on map i am getting strange js error such as
below

Error: a is undefined
Source File: http://maps.gstatic.com/intl/en_ALL/mapfiles/176c/maps2.api/main.js
Line: 1176 = ;var bm=function(a,b,c){c[0]=a[1]*b[2]-a[2]*b[1];c[1]=a[2]
*b[0]-a[0]*b[2];c[2]=a[0]*b[1]-a[1]*b[0]};Bk.g=function(a,b,c){if(!
a.lat&&!a.lon)a=new D
(a.y,a.x);this.ra=a;this.oj=j;this.Ea=0;this.L=this.vb=l;this.Br=
[];this.V=
[];this.va=xm;this.Gh=this.xn=j;this.uc=f;this.qi=this.lf=l;this.sD=b&&b.nodeData?
b.nodeData:j;this.f=j;if(b instanceof Bm||b==j||c!=j){this.va=b||
xm;this.uc=!c;this.Y={icon:this.va,clickable:this.uc}}else{b=this.Y=b||
{};this.va=b.icon||xm;this.oy&&this.oy(b);if(b.clickable!=j)
this.uc=b.clickable;if(b.isPng)this.lf=f}b&&Se(this,b,
["id","icon_id","name","description","snippet"])};

Below are my functions

function createMarker(point,name,html,category,uol,cluster) {
        var marker = null;
        if(point!='(0, 0)'){
                marker = new GMarker(point,gicons[category]);
                // Store the category and name info as a marker properties
                marker.mycategory = category;
                marker.myname = name;
                marker.uol = uol;
                marker.cluster = cluster;
                GEvent.addListener(marker, "click", function()
{ marker.openInfoWindowHtml(html);});
                gmarkers.push(marker);
        }
        return marker;
}

// Shows all markers of a requested unit, and ensures the checkbox is
checked
  function VWGM_clusterShow(cluster){
        for (var i=0; i<gmarkers.length; i++){
          if(gmarkers[i].cluster == cluster){
                  //gmarkers[i].show();
                  //var marker = createMarker(gmarkers[i].point,gmarkers
[i].name,gmarkers[i].html,gmarkers[i].category,gmarkers[i].uol,gmarkers
[i].cluster);
                  map.addOverlay(createMarker(gmarkers[i].point,gmarkers
[i].name,gmarkers[i].html,gmarkers[i].category,gmarkers[i].uol,gmarkers
[i].cluster));
          }
        }
        // Check the checkbox
        document.getElementById("VWGM_"+cluster+"_ClusterBox").checked =
true;
  }

  // Hides all markers of a requested unit, and ensures the checkbox
is cleared
  function VWGM_clusterHide(cluster) {
        for (var i=0; i<gmarkers.length; i++) {
          if (gmarkers[i].cluster == cluster) {
                //gmarkers[i].hide();
                map.removeOverlay(gmarkers[i]);
          }
        }
        // Clear the checkbox ==
        document.getElementById("VWGM_"+cluster+"_ClusterBox").checked =
false;
        // Close the info window, in case its open on a marker that we just
hid
        map.closeInfoWindow();
  }

Thanks again

On Oct 14, 4:57 pm, Umut Tuncdemir <[email protected]> wrote:
> Thanks for fast reply.
>
> I have added a control that skips entries with lat/lon (0,0) when
> filling bounds array.Now the zoom level is set to 4 in all cases in
> place of 2 as how it was before.And also if you click on last cluster
> (Toelevering en dienstverlening), the marker is located on iceland but
> the zoom level and position of map is not set automatically to see the
> marker on iceland properly..only a small part of it is visible..
>
> I can re-create the markers when any of them are matching with the
> selected cluster but i dont have a cluer before re-create the marker
> how destroy the existing one instead of hiding it as how i am doing
> currently ?
>
> On Oct 14, 4:09 pm, Marcelo <[email protected]> wrote:
>
> > 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