我在网站的主地图中添加了一个自定义图层(开放循环地图)。自定义图层正在工作,但在下拉菜单(mapTypeControlOptions)中,TERRAIN 显示为灰色,不是作为主要项目,而是作为复选框(参见附图)。
在地图代码下方:
var mapoptions = {
scrollwheel: scrollzoom,
zoom: zoom,
mapTypeControl: true,
mapTypeControlOptions: {
mapTypeIds: ['ocm', google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.TERRAIN,],style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT},
streetViewControl: streetview,
mapTypeId: google.maps.MapTypeId.ROADMAP,
sensor: 'false'
}
var map = new google.maps.Map(document.getElementById("advmap_canvas"),mapoptions);
var markerArray = [];
var markerIDArray = [];
var infowindow = new google.maps.InfoWindow();
map.mapTypes.set("ocm", new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
return "http://tile.opencyclemap.org/cycle/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
},
tileSize: new google.maps.Size(256, 256),
name: "OpenCycleMap",
maxZoom: 18
}));