- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
- <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
- <title>Google Maps JavaScript API v3 Example: KmlLayer KML</title>
- <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
- <script type="text/javascript">
- function initialize() {
- var chicago = new google.maps.LatLng(22.762836,120.376044);
- var myOptions = {
- zoom: 11,
- center: chicago,
- mapTypeId: google.maps.MapTypeId.HYBRID
- }
- var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
- var ctaLayer = new google.maps.KmlLayer('http://ABC/location.kml');
- ctaLayer.setMap(map);
- }
- </script>
- </head>
- <body onLoad="initialize()">
- <div id="map_canvas"></div>
- </body>
- </html>
在第19行(' ')內加入KML連結網址(不可使用虛擬IP,要可外連的位址)
執行結果