我尝试加载两个kml文件, admin.kml和pibkt.kml ,代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Google Maps KML</title>
<meta name="description" content="menampilkan polygon dari kml di googlemaps">
<meta name="author" content="El Cicko">
<style type="text/css">
body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://geoxml3.googlecode.com/svn/branches/polys/geoxml3.js"></script>
<script type="text/javascript" src="ProjectedOverlay.js"></script>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript">
var peta;
function peta_awal(){
// var jawa_barat = new google.maps.LatLng(0.89176, 123.38894);
var petaoption = {
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
peta = new google.maps.Map(document.getElementById("petaku"),petaoption);
var geoXml = new geoXML3.parser({map: peta});
geoXml.parse('admin.kml');
google.maps.event.addListener(peta,'click',function(event){
kasihtanda(event.latLng);
});
}
</script>
</head>
<body onload="peta_awal()">
<h2>Google Maps KML</h2>
<div id="petaku" style="height:500px"></div>
</body>
</html>
但当我将admin.kml更改为pibkt.kml 时,我的浏览器无显示,我不知道原因,因为我可以通过KML在线查看这两个文件,KMZ查看器Google驾驶 请帮帮我,我是全新的,非常感谢你的帮助,谢谢。
答案 0 :(得分:1)
That KML isn't valid。我怀疑geoxml3中的问题是标签内的标签。如果我将<Document>
代码替换为<Folder>
代码,则对我有用:
答案 1 :(得分:0)