I'm trying to give google earth api a start point which I get back from Google map Api v3(I have lat and lng). The thing I want to do is give a location to Google Earth and it can automatically moved to street view level.
So far what I did can only move to ground level. The following code is how I try move Google Earth's camera
var lookAt = DS_ge.createLookAt('');
lookAt.setLatitude(myRoute.steps[0].path[0].lat());
lookAt.setLongitude(myRoute.steps[0].path[0].lng());
lookAt.setRange(1000.0); //default is 0.0
DS_ge.getView().setAbstractView(lookAt);
Is there any way to achieve the result like I move the pegman to the location I want and show the street view. I think there's a pegman function make it work but I can't find it. Any suggestion will be helpful thx :)
To programmatically enter StreetView mode you need to add a gx:ViewOptions element to the LookAt element:
var lookAt = ge.createLookAt('');
// ... set your LookAt parameters
// don't forget default Altitude mode is ClampToGround
lookAt.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND)
// enable Street view option on ViewerOptions and add that to LookAt
var viewerOptions = ge.createViewerOptions('');
viewerOptions.setOption(ge.OPTION_STREET_VIEW, ge.OPTION_STATE_ENABLED);
lookAt.setViewerOptions(viewerOptions);
ge.getView().setAbstractView(lookAt);
To control whether the user can enter Street View using manual navigation controls, call
var navcontrol = ge.getNavigationControl();
navcontrol.setStreetViewEnabled(true);
来源:https://stackoverflow.com/questions/15634742/google-earth-api-programmatically-enter-streetview-mode