René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Positioning Google Earth with VBA | ||
The following snippet positions Google Earth so as to see Zürich:
Sub GoogleEarth() ' Use Menu Extras -> References ' then check "Google Earth 1.0 Type Library" Dim ge As ApplicationGE Set ge = New EARTHLib.ApplicationGE ge.SetCameraParams _ lat := 47 + 21/60 + 42/60/60 + 49/60/60/60, _ lon := 8 + 32/60 + 34/60/60 + 8/60/60/60, _ alt := 250, _ altMode := 1, _ Range := 1, _ Tilt := 70, _ Azimuth := 360 - 15, _ speed := 5 End Sub
The following snippet can be used to retrieve the camera coordinates in order to later postion the camera again:
Sub GoogleEarthGetCamera() Dim ge As ApplicationGE Dim cam As CameraInfoGE Set ge = New EARTHLib.ApplicationGE Set cam = ge.GetCamera(1) Selection.TypeText Text := _ "let cam.FocusPointLatitude = " & cam.FocusPointLatitude & Chr(11) _ & "let cam.FocusPointLongitude = " & cam.FocusPointLongitude & Chr(11) _ & "let cam.FocusPointAltitude = " & cam.FocusPointAltitude & Chr(11) _ & "let cam.FocusPointAltitudeMode = " & cam.FocusPointAltitudeMode & Chr(11) _ & "let cam.Range = " & cam.Range & Chr(11) _ & "let cam.Tilt = " & cam.Tilt & Chr(11) _ & "let cam.Azimuth = " & cam.Azimuth & Chr(11) _ & "ge.SetCamera cam,5" End Sub |