Can't hide certain types of objects in Google Maps
I am using the Google Maps API hidden map wizard ( http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html?utm_medium=twitter ) to customize the appearance of the map I want use which is zoomed to street level (zoom: 16). I basically want to get rid of all labels, text or icons. I get about 95%, but still some labels, namely the names of the squares, remain.
So far, I haven't found a way to hide these labels. While I suspect there is a bug in Google Maps (or this tool) settings, I would like to ask if anyone has the same problem? Does anyone have any tips on how to approach or possibly solve this?
Below is a screenshot that illustrates the problem. Any advice is appreciated. Thank!
function initialize() {
var mapStyles = [
{
"featureType": "administrative",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "road",
"elementType": "labels",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "road",
"elementType": "geometry.stroke",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "road",
"elementType": "geometry.fill",
"stylers": [
{ "visibility": "on" },
{ "color": "#ffffff" }
]
},{
"featureType": "transit",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "poi.attraction",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "poi.business",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "poi.government",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "poi.medical",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "poi.park",
"elementType": "labels",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "poi.place_of_worship",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "poi.school",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "poi.sports_complex",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "landscape.man_made",
"stylers": [
{ "visibility": "on" },
{ "color": "#fce8f0" }
]
},{
"featureType": "landscape.natural",
"elementType": "labels",
"stylers": [ { "visibility": "off" } ]
},{
"featureType": "landscape.natural",
"elementType": "geometry",
"stylers": [
{ "color": "#fce8f0" },
{ "visibility": "on" }
]
},{
"featureType": "water",
"elementType": "labels",
"stylers": [ { "visibility": "off" } ] },
{ }
];
var mapOptions = {
center: { lat: 52.519772, lng: 13.399022},
zoom: 16,
scrollwheel: false,
mapTypeControl: false,
panControl: false,
zoomControl: false,
scaleControl: false,
streetViewControl: false,
styles: mapStyles
};
var map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
source to share
If you want to get rid of all text labels, turn them off alltogether:
var mapStyles = [{
featureType: "all",
elementType: "labels.text",
stylers: [{
visibility: "off"
}]
}];
If you want to get rid of all labels, elementType: "labels"
both for labels.text
and for labels.icon
etc. will do . The same goes for object types.
var mapStyles = [{
featureType: "all",
elementType: "labels",
stylers: [{
visibility: "off"
}]
}];
From the documentation : note, however, that parent functions may include some additional functionality that is not included in one of their child types.
source to share