How do you remove the bed icons on Google Maps V3?

2020-04-10 01:51发布

I want to not show these icons on the maps embedded in my website:-

Does anyone know what the API call is. I have looked through https://developers.google.com/maps/documentation/javascript/reference and have had no luck at all.

1条回答
Anthone
2楼-- · 2020-04-10 02:32

These are Googles POI's. Not sure of the sub-type (see https://developers.google.com/maps/documentation/javascript/reference#MapTypeStyleFeatureType), but you can disable all types of POIs from appearing using something like this:

var myStyles =[
    {
        featureType: "poi",
        elementType: "labels",
        stylers: [
              { visibility: "off" }
        ]
    }
];

var myOptions = {
    zoom: 10,
    center: new google.maps.LatLng(54.42838,-2.9623),
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    styles: myStyles 
};

map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

In fact the beds fall under the 'poi.business' sub-type, which will also prevent things like shops showing up, if you use:

 featureType: "poi.business",
查看更多
登录 后发表回答