How to hide or disable default marker on google map with markerwithlabel

Viewed 1064

I'm using google map with markerwithlabel, and I just want to display markerwithlabel and no need display default icon marker

my sources:

var markerMap = new MarkerWithLabel({
      position: latLng,
      draggable: true,
      raiseOnDrag: true,
      map: map, 
      labelContent: "<div class='arrow'>1.300.000 VND</div>",
      labelAnchor: new google.maps.Point(30, 30),
      labelClass: "labels", // the CSS class for the label
      isClicked: false
});

result:

enter image description here

However it display double icon (consists: defeaul icon and markerwithlabel)

I have try a lot of ways but I can not find best way. How to hide or disable default icon google map and just display markerwithlabel?

Thank so much !

2 Answers

You need to set url of icon to hide default marker icon.

var markerMap = new MarkerWithLabel({
      position: latLng,
      draggable: true,
      raiseOnDrag: true,
      map: map, 
      icon: {
         url: '' // set url as ''
      }
      labelContent: "<div class='arrow'>1.300.000 VND</div>",
      labelAnchor: new google.maps.Point(30, 30),
      labelClass: "labels", // the CSS class for the label
      isClicked: false
});

icon: " ", // an empty string will hide the icon

              current_marker = new google.maps.Marker({
                                                        position: {lat: current_lat, lng: current_long},
                                                        map,
                                                        title: 'currentLocationMarker',
                                                        
                                                        icon: " ",  // an empty string will hide the icon
                                                        draggable: true
                                                    });
Related