菲利普斯在地图上的观点有问题:
地图样式:
var styles = [
{"stylers": [{ "visibility": "off" }]},
{
"featureType": "administrative",
"elementType": "geometry.stroke",
"stylers": [
{
"visibility": "on"
},
{
"color": "#ffffff"
},
{
"weight": 1
}
]
},
{
featureType: "administrative.province",
elementType: "geometry",
stylers: [
{ visibility: "off" }
]
},
{
featureType: "administrative.country",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
},
{
"featureType": "landscape",
"elementType": "all",
"stylers": [
{
"visibility": "on"
},
{
"color": "#a2d39c"
}
]
},
{
"featureType": "water",
"elementType": "all",
"stylers": [
{
"visibility": "on"
},
{
"color": "#0e76bc"
}
]
}
];
一切都很好,除了菲利普斯有奇怪的"头衔"在上面。我没有任何想法......
答案 0 :(得分:2)
我看到“Spratty Islands”,“西沙群岛”。你需要关闭:
{
"featureType": "landscape.natural",
"elementType": "labels",
"stylers": [
{ "visibility": "off" }
]
}
代码段
var geocoder;
var map;
function initialize() {
var map = new google.maps.Map(
document.getElementById("map_canvas"), {
center: new google.maps.LatLng(37.4419, -122.1419),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP,
styles: styles
});
geocoder = new google.maps.Geocoder();
geocoder.geocode({
'address': "Philipines"
}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
map.fitBounds(results[0].geometry.bounds);
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
google.maps.event.addDomListener(window, "load", initialize);
var styles = [{
"stylers": [{
"visibility": "off"
}]
}, {
"featureType": "administrative",
"elementType": "geometry.stroke",
"stylers": [{
"visibility": "on"
}, {
"color": "#ffffff"
}, {
"weight": 1
}]
}, {
featureType: "administrative.province",
elementType: "geometry",
stylers: [{
visibility: "off"
}]
}, {
featureType: "administrative.country",
elementType: "labels",
stylers: [{
visibility: "off"
}]
}, {
"featureType": "landscape",
"elementType": "all",
"stylers": [{
"visibility": "on"
}, {
"color": "#a2d39c"
}]
}, {
"featureType": "water",
"elementType": "all",
"stylers": [{
"visibility": "on"
}, {
"color": "#0e76bc"
}]
}, {
"featureType": "landscape.natural",
"elementType": "labels",
"stylers": [{
"visibility": "off"
}]
}];
html,
body,
#map_canvas {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px
}
<script src="https://maps.googleapis.com/maps/api/js"></script>
<div id="map_canvas"></div>