Try to add that:
var styles = {
default: null,
hide: [
{
featureType: 'poi.business',
stylers: [{visibility: 'off'}]
},
{
featureType: 'transit',
elementType: 'labels.icon',
stylers: [{visibility: 'off'}]
}
]
}; //Aqui você define o estilo na qual os ícones ficam invisíveis
map.setOptions({styles: styles['default']}); //Aqui você aplica o estilo ao seu mapa
Taken from Google’s own documentation: https://developers.google.com/maps/documentation/javascript/examples/hiding-features
In your code would look like this:
var styles = {
default: null,
hide: [
{
featureType: 'poi.business',
stylers: [{visibility: 'off'}]
},
{
featureType: 'transit',
elementType: 'labels.icon',
stylers: [{visibility: 'off'}]
}
]
};
function initMap( lat, lng, nome, lojas ) {
var myLatLng = {lat, lng};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 16,
center: myLatLng
});
map.setOptions({styles: styles['hide']});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: nome
});
}
Access all the featureType
at the following link: https://developers.google.com/maps/documentation/javascript/style-reference#style-Features
In case I changed 'default' to 'Hide'
map.setOptions({styles: styles['hide']});
– adventistaam
Where do I find this list? Like a
featureType: 'poi.business',
?– adventistaam
@adventistaam looks at the end of the question, I edited ;)
– Leonardo Bonetti
Excellent! Thank you very much!
– adventistaam