I'm unable to find any information as to how to remove or开发者_StackOverflow中文版 change the colors of the equator and international date-line in Google Maps JS API v3. I've been searching the documentation and web for any mention of what controls them.
A few years late for this answer, but I was trying to figure this out and worked out how to properly remove the equator and dateline. It seems that for the administrative layer country borders are considered strokes but the equator and dateline are fills, so you can set your style to this to get rid of those lines:
{
"featureType": "administrative",
"elementType": "geometry.fill",
"stylers": [{ "visibility": "off" }]
}
The code below will change the color of the equator and international date-line, but may also have side effects of changing other colors. Change the rgb value for hue
to whatever you want. Also, change the two occurrences of "MyCustomMap" to whatever you want to call the map. The code assumes that you already have a Google map object and that it is stored in a variable named map
.
var mapStyle = [
{
featureType: "administrative",
elementType: "geometry",
stylers: [
{ hue: "#00ff2b" }
]
}
];
var styledMap = new google.maps.StyledMapType(mapStyle);
map.mapTypes.set('myCustomMap', styledMap);
map.setMapTypeId('myCustomMap');
If you want to remove the equator and international date-line, you can use the code below. Everything said about the code above applies here too, including the stuff about it possibly having side effects (but this time, the side effect will be to make other things invisible as well).
var mapStyle = [
{
featureType: "administrative",
elementType: "geometry",
stylers: [
{ visibility: "off" }
]
}
];
var styledMap = new google.maps.StyledMapType(mapStyle);
map.mapTypes.set('myCustomMap', styledMap);
map.setMapTypeId('myCustomMap');
精彩评论