0
我有一个通过MapTiler创建的漂亮的小自定义地图,它很容易让它用GMaps渲染。下面是几行代码的基础知识。Google Maps V3 KML图层覆盖ImageMapType
我也有一个可爱的小KML层也呈现罚款。
但是,对于我的生活,我无法同时显示两个图层。只要指示KML呈现,自定义地图图层就会消失。萤火虫甚至告诉我,我的自定义瓷砖甚至没有要求!理想情况下,我需要在我的自定义地图图层上使用KML图层。这将显示一些英国地标的位置。
在我的脑海里,我在思考投影类型和冲突,但是当两个图层都单独在底图上正确渲染时,我确实被蒙在鼓里。
任何人都可以在Google Maps V3中的自定义地图类型上给我KML层上的建议吗?
谢谢
var MyCustomMapType = new google.maps.ImageMapType({
getTileUrl: function(tile, zoom) {
return "/static/images/maps/uk/" + zoom+"/"+tile.x+"/"+ tile.y +".png";
},
tileSize: new google.maps.Size(256, 256),
});
function init(){
var mapOpts = {
zoom: 6,
center: new google.maps.LatLng(53.94315470224928, -3.515625),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), mapOpts);
map.overlayMapTypes.insertAt(0, MyCustomMapType);
var cathedrals = new google.maps.KmlLayer('http://pointing_at_my/kml/');
// as soon as this executes, ImageMapType layer disappears
cathedrals.setMap(map);
}