CreateNewFeatureLayer

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

 

JavaScript

 

CreateNewFeatureLayer(

       layerName,

       LayerGeomType,

       sConnectionString,

       lParentGroupID)

 

C#

 

ILayer61 CreateNewFeatureLayer(

       string                layerName,

       LayerGeometryType     LayerGeomType,

       string                sConnectionString,

       int                   lParentGroupID)

 

C++

 

HRESULT CreateNewFeatureLayer(

        BSTR                  layerName,

        LayerGeometryType     LayerGeomType,

        BSTR                  sConnectionString,

        LONG_PTR              lParentGroupID,

        ILayer61 **           pILayer) 

 

Parameters:

layerName

The name of the layer as it appears in the Project Tree.

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.

Note: Only a new Shape file can be created using this method. The connection string must include “TEPlugName=OGR” and “FileName=NameOfShapeFile.shp”.

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 IProjectTree61.CreateGroup.

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

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

Return Value

pILayer 

An ILayer61, representing the newly created layer.

Exceptions

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