Automating Google Earth
Posted by admin - Dec 15, 2009 Articles, Dani Vainstein 0 0 Views : 713 Receive Updates For This Category
Article Tools
- Print this page
- Add Comment
- Send to Friend
- Last Updated on :
Jul 17, 2011
One big question I’ve been asked a few days ago. it is possible to automate Google Earth with QuickTest?
the answer is yes!
to do that you need some follow some pre-requisites.
- Web + ActiveX add-ins must be loaded.
- Google heart plug-in must be installed as an add-on on your browser http://code.google.com/apis/earth/.
- Familiarize with Google Earth API .
This demo works only on browser embedded Google Earth maps. The demo will change view types, display controls on the window and “DIVE” into Times Square, New York
the demo was tested on Internet Explorer 7.
Const URL = "http://earth-api-samples.googlecode.com/svn/trunk/demos/kmlplayground/index.html"
Const SW_MAXIMIZED = 3
' Closing any open browsers and reopen URL
SystemUtil.CloseProcessByName "iexplore.exe"
SystemUtil.Run "iexplore.exe", URL, "", "open", SW_MAXIMIZED
Browser("CreationTime:=0").Page("index:=0").Sync
Set objActiveX = Browser("CreationTime:=0").Page("index:=0").ActiveX("progid:=GEPluginCoClass.GEPluginCoClass.1.0", "location:=0").Object
' setting variables values
ALTITUDE_ABSOLUTE = objActiveX.ALTITUDE_ABSOLUTE
VISIBILITY_SHOW = objActiveX.VISIBILITY_SHOW
ALTITUDE_RELATIVE_TO_GROUND = objActiveX.ALTITUDE_RELATIVE_TO_GROUND
MAP_TYPE_EARTH = objActiveX.MAP_TYPE_EARTH
MAP_TYPE_SKY = objActiveX.MAP_TYPE_SKY
SPEED_TELEPORT = objActiveX.SPEED_TELEPORT
wait 2
' Changing to SKY view
Set geOptions = objActiveX.getOptions()
Call geOptions.setMapType( MAP_TYPE_SKY )
wait 5
' Changing to EARTH view
Call geOptions.setMapType( MAP_TYPE_EARTH )
' Setting to Minimum zoom at max speed
geOptions.setFlyToSpeed( SPEED_TELEPORT )
Set kmlLookAt = objActiveX.getView().copyAsLookAt( ALTITUDE_ABSOLUTE )
kmlLookAt.setRange(50000000)
objActiveX.getView().setAbstractView(kmlLookAt)
wait 2
' adding visual controls
geOptions.setGridVisibility( true )
geOptions.setStatusBarVisibility(true)
geOptions.setScaleLegendVisibility( true )
geOptions.setMouseNavigationEnabled( true )
geOptions.setOverviewMapVisibility( true )
' retrieve the navigating control
Set geNavigationControl = objActiveX.getNavigationControl()
geNavigationControl.setVisibility( VISIBILITY_SHOW )
Set geView = objActiveX.getView()
Set kmlLookAt = geView.copyAsLookAt( ALTITUDE_RELATIVE_TO_GROUND )
' ** MAIN DEMO : set speed, tilt and heading
geOptions.setFlyToSpeed(0.5)
kmlLookAt.setTilt(0)
kmlLookAt.setHeading(0)
' Times Square, New York, NY
kmlLookAt.setLatitude( 40.7594 )
kmlLookAt.setLongitude( -73.985 )
' setting new values
objActiveX.getView().setAbstractView(kmlLookAt)
'zooming...
For i = 1 to 17
kmlLookAt.setRange(kmlLookAt.getRange() * 0.5)
objActiveX.getView().setAbstractView(kmlLookAt)
Wait 1
Next


