SaveAsKml

This method saves the specified object or group to a compressed KML file (KMZ). For security reasons the file is saved to a predefined “Skyline\TerraExplorer” folder in the “Application Data” space of the current user. The full path of the saved file is provided in the method’s return value. You can also use %APPDATA% in Windows Explorer to locate the path on your computer.

 

Note:    If the folder contains a file by the same name, the existing file is overwritten without a prompt.

Note:    The Application Data folder path changes between different users and different Windows operating systems. To find the path used by your client look at the %APPDATA% environment variable.

JavaScript

 

SaveAsKml(

       KmlName,

       ObjectID)

 

C#

 

string SaveAsKml(

       string KmlName,

       string ObjectID)

 

C++

 

HRESULT SaveAsKml(

       BSTR KmlName,

       BSTR ObjectID,

       BSTR * pVal) 

Parameters

KmlName

The name for the KML file. If it is not specified, a KMZ extension is added to the file name automatically. If KML extension is specified, an uncompressed KML is created.
Note: A file name with a full path cannot be used here.

ObjectID

The object or group that is being saved to a KML file. You can obtain the ObjectID by one of the following methods:

·          Create the group using IProjectTree80.CreateGroup.

·          Find the object or group, if you know the name, using IProjectTree80.FindItem.

·          Traverse the Tree using IProjectTree80 methods such as GetNextItem, until you come to the desired ObjectID.

Return Value

pVal

A full path of the KML file being created.

Exceptions

HRESULT can return any of the values listed in the HRESULT Return Values list, as well as the following values:

TE_E_INFOTREE_PARENTNOTGROUP

The group ID entered does not represent a valid group in the Project Tree.

TE_E_INFOTREE_ITEMNOTGROUP

The item entered is not a group and therefore cannot be used as a group.

TE_E_INFOTREE_CANTUSEROOT

Cannot use Tree root for this operation

TE_E_INFOTREE_ITEMISGROUP

Item ID is a group so an object cannot be retrieved.