0
我已經從谷歌地球導出3D模型的KML文件(ICBC.kml),我想將3D模型加載到谷歌地球插件,但我無法獲得結果,非常感謝您的建議。谷歌地球加載KML文件失敗
JavaScript代碼負荷KML
// Create the placemark.
var placemark = ge.createPlacemark('');
// Get the current view`enter code here`
var myCamera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
// Set new latitude and longitude values
myCamera.setLatitude(30.55552076525944);
myCamera.setLongitude(114.3344795151639);
myCamera.setAltitude(500);
// Placemark/Model/Location
var loc = ge.createLocation('');
loc.setLatitude(myCamera.getLatitude());
loc.setLongitude(myCamera.getLongitude());
// Update the view in Google Earth
ge.getView().setAbstractView(myCamera);
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.OpenTextFile("http://localhost/ICBC.kml",1,true);
var kmlobject = ge.parseKml(f.ReadAll());
ge.getFeatures().appendChild(kmlobject);
var la = ge.createLookAt('');
la.set(30.55552076525944, 114.3344795151639, 500, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 45, 900);
ge.getView().setAbstractView(la);
非常感謝你 – zhongjiejiang 2012-08-14 08:51:48
是否行得通接受回答以後的用戶:) – Nuxy 2012-08-14 09:15:31