I want to remove the display of icons from the map. Styling via GoogleMaps Wizard is not suitable, since the map is not static. In google maps api there is a solution through styling maps, which was implemented, but it does not work. What can you advise, maybe some errors in the code or need to be rewritten in a different way?

The badges are these - badges

What is in the code now - code

  • one
    Please insert the code itself into the question instead of the screenshot of the code (the "Edit" button) - Denis

1 answer 1

What you want to clean is called the business layer I cleaned it so

var customMapType = new google.maps.StyledMapType([ { featureType: "poi.business", stylers: [ { visibility: "off" } ] } ], { name: 'Custom Style' }); var customMapTypeId = 'custom_style'; var mapOptions = { zoom: 15, center: location, mapTypeControl: false, mapTypeControlOptions: { mapTypeIds: [google.maps.MapTypeId.ROADMAP, customMapTypeId] } } var map = new google.maps.Map(element, mapOptions); map.mapTypes.set(customMapTypeId, customMapType); map.setMapTypeId(customMapTypeId); 

element - the actual element on which the binding occurs

  • Thanks a lot! - jkorichneva
  • Do not forget to remove the button on the map that allows you to switch the style, otherwise the user will be able to switch. - sirishotka