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?
Just set clickableIcons: false in the options you initialise the Map with. I added an example, you have to zoom enough to see those points. Thank you! These POI's should be turned off by default in the APi.
Click the "My Places" button just beneath the search bar. Click "Maps" and wait for the list of maps to appear down the left side of the screen. When they do, click the title of the map containing the marker that you want to remove.
Step 1 Go to Add or Edit Map and Scroll down to the 'Infowindow Settings' section. Step 2 Enable the box of 'Hide Markers on Page Load' option. Step 3 Click on Save Map and open it in browser.
If you want to remove the pin from Google Maps, simply right click on it and select "Remove this destination." Poof, it's gone.
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.
You might have a look at custom styled maps.
There is also a wizard that helps to build the options array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With