| 9 | {{{ |
| 10 | #!diff |
| 11 | --- googlemap2.html 2008-09-19 15:35:30.000000000 +0800 |
| 12 | +++ googlemap3.html 2008-09-22 14:52:38.000000000 +0800 |
| 13 | @@ -16,7 +16,7 @@ |
| 14 | map.addControl(new GLargeMapControl()); // 加入左上角比例尺規控制列 |
| 15 | map.addControl(new GScaleControl()); // 加入左下角比例尺狀態列 |
| 16 | map.addControl(new GMapTypeControl()); // 加入右上角"地圖","衛星","混合地圖"按鈕 |
| 17 | - map.setCenter(new GLatLng(23.8,121), 7); // 設定預設經緯度北緯 23.8, 東經 121, 預設比例尺 100 公里(7) |
| 18 | + map.setCenter(new GLatLng(23.8,121), 6); // 設定預設經緯度北緯 23.8, 東經 121, 預設比例尺 200 公里(6) |
| 19 | map.setMapType(G_SATELLITE_MAP); // 設定預設底圖為"衛星" |
| 20 | } |
| 21 | var request = GXmlHttp.create(); // 產生一個非同步的 AJAX XMLHttp 物件 |
| 22 | @@ -41,6 +41,19 @@ |
| 23 | } |
| 24 | } |
| 25 | request.send(null); // 送出 XMLHttp 物件的要求 |
| 26 | + |
| 27 | + // 產生 GGeoXml 物件來讀取 KML 檔案並貼上 Google Map 圖層 |
| 28 | + // - 參考 http://googlemapsapi.blogspot.com/2007/03/kml-and-georss-support-added-to-google.html |
| 29 | + // - 參考 http://code.google.com/apis/maps/documentation/reference.html#GGeoXml |
| 30 | + // - GGeoXml(urlOfXml) 必須輸入標準網址,不能輸入相對位址 |
| 31 | + var gx = new GGeoXml("http://trac.nchc.org.tw/OR1-0866.kml"); |
| 32 | + map.addOverlay(gx); |
| 33 | + gx = new GGeoXml("http://trac.nchc.org.tw/OR1-0868.kml"); |
| 34 | + map.addOverlay(gx); |
| 35 | + gx = new GGeoXml("http://trac.nchc.org.tw/OR2-1547.kml"); |
| 36 | + map.addOverlay(gx); |
| 37 | + gx = new GGeoXml("http://trac.nchc.org.tw/OR3-1297.kml"); |
| 38 | + map.addOverlay(gx); |
| 39 | } |
| 40 | //]]> |
| 41 | </script> |
| 42 | }}} |