Reputation: 113
I'm using this to remove all map labels from a Google Map:
var customStyled = [
{
featureType: "all",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
];
map.set('styles',customStyled);
Is there a way to show ONLY country names, for example? Or ONLY country name and state name? If not, does anyone know where to find a complete list of ALL label element names so that I can disable all of them except for the ones I want?
Upvotes: 3
Views: 4685
Reputation: 32158
You can use the Styling wizard of Google Maps API that shows all available options and allows to generate custom style.
https://mapstyle.withgoogle.com/
You can set visibility on country, province, locality, etc. labels as shown in my screenshot
The resulting style might be something like
[
{
"featureType": "administrative.country",
"elementType": "labels.text",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "administrative.land_parcel",
"elementType": "labels.text",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "administrative.locality",
"elementType": "labels.text",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "administrative.neighborhood",
"elementType": "labels.text",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "administrative.province",
"elementType": "labels.text",
"stylers": [
{
"visibility": "on"
}
]
}
]
I hope this helps!
Upvotes: 2