[http://wfr.tcl.tk/fichiers/images/ge.jpg] [GS] The title of this page is slightly megalomaniac ;-) But it's just a few examples that show how to use the COM API of [Google] Earth with [Tcl]. The [COM] API description could be found here [http://earth.google.com/comapi/]. Examples tested on console: - Instantiating a Google Earth object: package require tcom set application [::tcom::ref createobject "GoogleEarth.ApplicationGE"] - Query if Google Earth is initialised (1) or not (0): $application IsInitialized - Get the version infos: set apptype [$application VersionAppType] set vbuild [$application VersionBuild] set vmajor [$application versionMajor] set vminor [$application versionMinor] - Fly through a predefined route: # SetCameraParams # # Latitude in degrees. Between -90 and 90. # Longitude in degrees. Between -180 and 180. # Altitude in meters # Altitude mode that defines altitude reference origin (1=above ground, 2=absolute) # Distance between focus point and camera in meters # If !=0 camera will move backward from range meters along the camera axis # Tilt angle in degrees. Between 0 and 90. Looking to the horizon=90, looking to the center of Earth=0 # Azimuth angle in degrees. Looking North=0, East=90, South=180, West=270 # Speed factor. Must be >= 0, if >=5.0 it's the teleportation mode $application SetCameraParams 45 1 1000 1 1 60 345 1 $application SetCameraParams 46 1 1000 1 1 60 345 1 $application SetCameraParams 47 1 1000 1 1 60 345 1 $application SetCameraParams 48 1 1000 1 1 60 345 1 $application SetCameraParams 48 -4 1000 1 1 60 345 1 $application SetCameraParams 48 -4 3000 1 1 60 300 1 - Retrieve camera infos: set cam [$application GetCamera 1] set fplat [$cam FocusPointLatitude] set fplong [$cam FocusPointLongitude] set fpalt [$cam FocusPointAltitude] set fpaltm [$cam FocusPointAltitudeMode] set range [$cam Range] set tilt [$cam Tilt] set azm [$cam Azimuth] - Save screenshot in black and white: # SaveScreenShot # Quality factor of output image. Lowest quality is 0 and highest quality is 100. $application SaveScreenShot C:/tmp/ge01.jpg 40 - Search a location: set sc [$application SearchController] $sc Search "Paris" - Open a KML file from local filesystem and from network: $application OpenKmlFile C:/tmp/KML_samples.kml 1 $application OpenKmlFile http://code.google.com/apis/kml/documentation/KML_Samples.kml 1 ---- See also Steve Landers and David Roseman' articles at the Annual Tcl Conference 2010 : Augmented Reality, Google Earth and Tcl/Tk [http://www.tclcommunityassociation.org/wub/proceedings/Proceedings-2010/SteveLanders/Windfarm/windfarm.pdf] See also [tcom] ---- <> Category Internet | Category Geography | Category COM | Category GoogleTools