Google Earth Api - programmatically enter StreetView mode

后端 未结 1 1251
情深已故
情深已故 2021-01-20 17:30

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 an

1条回答
  •  逝去的感伤
    2021-01-20 17:54

    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);
    

    0 讨论(0)
提交回复
热议问题