Home > Working with SGWorld > Creator (ICreator6) > CreateNewFeatureLayer

CreateNewFeatureLayer

The CreateNewFeatureLayer method enables you to create a new feature layer directly from TerraExplorer.

 

JavaScript

 

CreateNewFeatureLayer(

      layerName,

      LayerGeomType,

      sConnectionString,

      lParentGroupID)

 

C#

 

ILayer6 CreateNewFeatureLayer(

      string             layerName,

      LayerGeometryType LayerGeomType,

      string             sConnectionString,

      int                lParentGroupID)

 

C++

 

HRESULT CreateNewFeatureLayer(

       BSTR               layerName,

       LayerGeometryType  LayerGeomType,

       BSTR               sConnectionString,

       LONG_PTR           lParentGroupID,

       ILayer6 **         pILayer) 

 

Parameters:

layerName

A full path name or a URL to where the layer should be saved.

LayerGeomType

An enum that determines the geometry type. The following are the possible LayerGeometryType values:

·         LGT_NONE = -1

·         LGT_POINT = 0

·         LGT_POLYLINE = 1

·         LGT_POLYGON = 2

·         LGT_COLLECTION = 3

sConnectionString

A string that specifies information about the layer data source and the means of connecting to it.

lParentGroupID

The Project Tree group in which the layer is created. If it is set to zero, the object is created under the root. You can obtain the GroupID by one of the following methods:

§   Create the group using IProjectTree6.CreateGroup.

§  Find the group, if you know the name, using IProjectTree6.FindItem.

§  Traverse the Tree using IProjectTree6 methods such as GetNextItem(), until you come to the desired GroupID.

Return Value

pILayer 

An ILayer6, representing the newly created layer.

Exceptions

See: HRESULT Return Values for a list of possible values returned by the HRESULT.