你好,我可以使水变暗的同时改变为一个样式的地图,以便其他值得到重置。我想要的是一张像MapTypeId.TERRAIN那样的绿色景观和更深的水的地图。我可以设法让水变得更深,现在也想要像MapTypeId.TERRAIN一样的绿色景观。你能推荐一种方法吗?谢谢
发布于 2010-10-01 21:58:25
目前,除了默认的ROADMAP类型之外,Google Styled Maps不能应用于其他映射类型。2010年5月31日,谷歌邮件列表上的一名员工证实了这一点:
但是,如果您只是想要一个带有深色水域的更绿色的地形,您仍然可以设置默认ROADMAP的样式,使其如下所示:

示例源代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps Dark Water Style Demo</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 550px; height: 300px;"></div>
<script type="text/javascript">
var darkStyle = [
{
featureType: "landscape",
elementType: "all",
stylers: [
{ visibility: "on" },
{ hue: "#1aff00" },
{ lightness: -17 }
]
},{
featureType: "water",
elementType: "all",
stylers: [
{ hue: "#1900ff" },
{ invert_lightness: true },
{ lightness: -56 },
{ saturation: 31 },
{ visibility: "simplified" }
]
},{
featureType: "administrative",
elementType: "all",
stylers: [
{ gamma: 0.82 },
{ visibility: "on" },
{ lightness: -18 },
{ hue: "#00ff4d" },
{ saturation: 27 }
]
}
];
var map = new google.maps.Map(document.getElementById('map'), {
mapTypeControlOptions: {
mapTypeIds: [
'darkwater',
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.TERRAIN
]
},
center: new google.maps.LatLng(30, 0),
zoom: 1,
mapTypeId: 'darkwater'
});
map.mapTypes.set(
'darkwater', new google.maps.StyledMapType(darkStyle, {
name: 'Dark'
})
);
</script>
</body>
</html>发布于 2012-02-16 23:12:16
您可以使用此地图以可视方式设置地图样式:http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html
https://stackoverflow.com/questions/3835415
复制相似问题