このサンプルは、Google Earthに検索窓に入力した住所の場所を表示します。サンプルが表示されたら、検索窓に住所(例:東京都板橋区中丸町)を入力して[Fly Here!]ボタンをクリックします。すると、Google Earthに入力した住所が表示されます。
google.earth.createInstance('map3d',
function (pluginInstance) { // initCallback
ge = pluginInstance;
ge.getWindow().setVisibility(true);
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);
$('#btnFly').click(function () {
var geocodeLocation = $('#txtLocation').val();
var geocoder = new google.maps.ClientGeocoder();
geocoder.getLatLng(geocodeLocation, function (point) {
if (point) {
var lookAt = ge.createLookAt('');
lookAt.set(point.y, point.x, 10, ge.ALTITUDE_RELATIVE_TO_GROUND,
0, 60, 20000);
ge.getView().setAbstractView(lookAt);
}
});
});
},
function (errorCode) { // failureCallback
});