5
所以我創建了一些自定義JSON,使海洋更飽和的藍色,但現在似乎無法讓地圖默認爲TERRAIN視圖,它只是去到標準的ROADMAP視圖,似乎無法弄清楚爲什麼會發生這種情況,有什麼想法?谷歌地圖 - 使用自定義JSON樣式*和*地形視圖
function initialize() {
// Create an array of styles.
var blueOceanStyles = [
{
featureType: "water",
stylers: [
{ hue: "#4b83d4" },
{ saturation: 53 }
]
}
];
// Create a new StyledMapType object, passing it the array of styles,
// as well as the name to be displayed on the map type control.
var blueOceanType = new google.maps.StyledMapType(blueOceanStyles,
{name: "Blue Oceans"});
// Create a map object, and include the MapTypeId to add
// to the map type control.
var mapOptions = {
zoom: 5,
center: new google.maps.LatLng(50, 0),
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.TERRAIN,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.TERRAIN, 'blue_oceans']
}
};
var map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
//Associate the styled map with the MapTypeId and set it to display.
map.mapTypes.set('blue_oceans', blueOceanType);
map.setMapTypeId('blue_oceans');
}
那太好了,謝謝,我想地形圖與我的風格在頂部,這已經做到了。非常感謝! – Nick 2012-02-08 09:07:26