我已将此代码(见下文)加载到我的Weebly网页中,并将我的.kml文件放在另一台服务器上,并添加了mime类型.kml。但是我在网页上看到的只是地图的显示,上面没有kml内容。就像没有访问.kml数据一样?
我不知道会发生什么......但是当我在浏览器中直接尝试使用url到kml文件时,我得到了#34;页面无法找到。"
接下来要尝试什么?我的代码有问题吗? 谢谢! 鲍勃
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>KML Layers</title>
<style>
#map-canvas { width:500px; height:300px; }
.layer-wizard-search-label { font-family: sans-serif };
</style>
<script src="https://maps.googleapis.com/maps/api/js? v=3.exp&sensor=false"></script>
<script>
function initialize() {
var world = new google.maps.LatLng(24.174513811778894, 6.083308984374969);
var mapOptions = {
zoom: 1,
center: world
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var ctaLayer = new google.maps.KmlLayer({
url: 'http://www.godanddeaf.org/HisHands/kml/HHR- STARTEDtranslationof1742WORDS.kml'
});
ctaLayer.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>`