CreateFeatureLayer

CreateFeatureLayer loads a feature layer into the project. A feature layer is a visual representation of a geographic data set like roads, national parks, political boundaries, and rivers using geographic objects such as points, lines, and polygons and optional corresponding annotation objects.

TerraExplorer enables you to load feature layers from remote or local databases. Various file formats are supported through a set of external plug-ins. See: “Feature Layers for a list of the supported connection string values and parameters. You are always connected to the data source (local or remote), and all changes to the feature layers can be saved to the original source file. You can get the latest updates to a layer source by refreshing the layer.

TerraExplorer handles differently layers that are created by loading native feature sources (Shapefiles and GeoDatabase files, and all server inputs) and layers that are created by loading non-native feature files (e.g., DXF, ASCII and OpenFlight files). For the former, a layer object containing the geographic objects is created in the Project Tree while for the latter the geographic objects are read and put in the TerraExplorer Project Tree as a Group.

If the source file coordinate system is not the same as the MPT file Terrain Coordinate system, you can reproject it using the IFeatureLayer66.Reproject method.

CreateFeatureLayer only loads a feature layer into the project. If you want to load the new layer on the terrain, use the IFeatureLayer66.Load method.

 

 

JavaScript

 

CreateFeatureLayer(

       layerName,

       sConnectionString,

       GroupID)

 

C#

 

IFeatureLayer66 CreateFeatureLayer(

       string        layerName,

       string        sConnectionString,

       [string       GroupID = ""])

 

C++

 

HRESULT CreateFeatureLayer(

        BSTR  layerName,

        BSTR  sConnectionString,

        BSTR  GroupID,

        IFeatureLayer66 **  pILayer) 

Parameters

layerName

A string representing the name of the layer.

sConnectionString

Specifies information about the data source and the means of connecting to it. See: Feature Layers for a list of the supported connection string values and parameters.

GroupID

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

·          Create the group using IProjectTree66.CreateGroup.

·          Find the group, if you know the name, using IProjectTree66.FindItem.

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

Return Value

pILayer

An IFeatureLayer66, representing the newly created layer.

Exceptions

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