Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google maps remove interactions with unneeded elements

I am working on application which uses google maps.

When I zoom the map closer, a lot of useless (for the purpose of my app) appears. Here is the example:enter image description here.

Not only I do not need any of the Casa Salvador, Liquid, Valeria Peluqueros things, they are also interactive (the mouse is changing on hover, you can click and popup appears).

I thought that I can easily disable them through google maps options, where I can disable default user interface and a lot of other things, but I failed to find any option related to my needs.

Does anyone have an idea how to:

  • completely remove the elements I listed
  • make them visible but not interactive
like image 319
Salvador Dali Avatar asked Jul 28 '26 05:07

Salvador Dali


1 Answers

I have been going through the same problem. 1. To remove them you have apply custom styles to your map.

var styleArray = [
  {
    featureType: "poi.business",
    elementType: "labels",
    stylers: [
      { visibility: "off" }
    ]
  }
];
map.setOptions({styles: styleArray}); 

This will remove all the business labels. For more help: https://developers.google.com/maps/documentation/javascript/styling#creating_a_styledmaptype

  1. exactly your answer I guess: http://jsfiddle.net/mrak/dHWVM/

Regards

Suyash

like image 119
Suyash Dixit Avatar answered Jul 30 '26 09:07

Suyash Dixit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!