Google maps 谷歌地图瓷砖-街道和标签叠加样式?
我有一个谷歌地图,在上面插入一个自定义图层,然后在上面添加谷歌街道和标签。我一直在四处搜索,看看是否有任何方法可以像路线图一样将街道和标签叠加样式化 所以我有这个:Google maps 谷歌地图瓷砖-街道和标签叠加样式?,google-maps,overlay,Google Maps,Overlay,我有一个谷歌地图,在上面插入一个自定义图层,然后在上面添加谷歌街道和标签。我一直在四处搜索,看看是否有任何方法可以像路线图一样将街道和标签叠加样式化 所以我有这个: var myStyle = [ { featureType: "road.arterial", elementType: "all", stylers: [ { visibility: "simplified" } ] },{ featureType: "road.highway",
var myStyle = [
{
featureType: "road.arterial",
elementType: "all",
stylers: [
{ visibility: "simplified" }
]
},{
featureType: "road.highway",
elementType: "all",
stylers: [
{ visibility: "simplified" }
]
}
];
var myTileLayer = {
getTileUrl: function(coord, zoom) {
return "myTiles.php?" +
"z=" + zoom + "&x=" + coord.x + "&y=" + coord.y + "&client=api";
},
tileSize: new google.maps.Size(256, 256),
isPng: true
};
var labelTiles = {
getTileUrl: function(coord, zoom) {
return "http://mt0.google.com/vt/v=apt.116&hl=en-US&" +
"z=" + zoom + "&x=" + coord.x + "&y=" + coord.y + "&client=api";
},
tileSize: new google.maps.Size(256, 256),
isPng: true
};
var googleLabelLayer = new google.maps.ImageMapType(labelTiles);
var mapOptions = {
mapTypeControlOptions: {
mapTypeIds: ['mystyle', google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.TERRAIN]
},
zoom: 9,
center: map_center,
mapTypeId: 'mystyle'
};
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
map.mapTypes.set('mystyle', new google.maps.StyledMapType(myStyle, { name: 'My Style' }));
map.overlayMapTypes.insertAt(0, myTileLayer);
map.overlayMapTypes.insertAt(1, googleLabelLayer);
有人知道吗?是的,你可以设计街道和标签,至少在有限的范围内。例如,可以按如下方式更改道路的绿色:
[
{
featureType: "road",
elementType: "geometry",
stylers: [
{ visibility: "simplified" },
{ hue: "#3bff00" }
]
}
]
使用位于的Google Maps API样式的地图向导来使用不同的设置。它还将生成复制样式所需的代码。它还可以帮助您确定API不支持的操作。例如,我不认为目前有办法使标签斜体。(如果有,好吧,但你明白我的意思。)
还有一件事:地图API v3.5不久前问世。您可能需要查看发行说明、公告或其他信息,以防现在有一些功能由于任何原因无法显示在向导中