Google Earth Api - programmatically enter StreetView mode

爷,独闯天下 提交于 2019-12-01 22:32:41

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);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!