76

I'm using Google Map API V3 and I noticed there are a lot of markers which are here even though I don't need them. For examples, some schools or other places with InfoWindows appearing when clicking on them.

Is there any way I can remove them or is it just not possible?

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
Weier
  • 1,339
  • 1
  • 10
  • 20
  • If you want an example: http://code.google.com/apis/maps/documentation/javascript/examples/map-simple.html Zoom on NYC for example you can see a lot of Point of interest that are clickable. For example: "City University of New York Brooklyn College - more info » 2900 Bedford Avenue, New York, NY 11210, United States" – Weier Sep 24 '11 at 13:26

2 Answers2

173

The only markers that should show up on the map are those you add yourself. Care to share your code or a page where we can see this happening?

Update: ok, these aren't really 'markers' in the normal sense of the word, they're just points of interest, which happen to behave like markers in that you can click on them and see infowindows. It seems to me that these might be of the class MapTypeStyleFeatureType, probably of types like poi.medical, poi.park, transit.station.rail and so on. I wonder if you could use the MapTypeStyle. Maybe something like this:

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

var myOptions = {
    zoom: 10,
    center: homeLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    styles: myStyles 
};

You might also want to look at the Styled Map Wizard

Update, July 2016: The Maps API also now has an option you can specify in the MapOptions, clickableIcons, which if you set to false, the icons for these POIs will appear but clicking them doesn't open Google's infowindows. This saves you having to set the styles to hide the icons unless you want to, if all you need to do is prevent the clicks opening the infowindows. Just set clickableIcons: false in the options you initialise the Map with.

Uri
  • 89
  • 1
  • 6
duncan
  • 31,401
  • 13
  • 78
  • 99
11

You might have a look at custom styled maps.

There is also a wizard that helps to build the options array.

facundofarias
  • 2,973
  • 28
  • 27
Jiri Kriz
  • 9,192
  • 3
  • 29
  • 36
  • And do you know how to use the style created in the Google Cloud console in your map? I can't get it to work. – Cagy79 Nov 14 '20 at 21:05