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 (Shape 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 ILayer61.Reproject method.
JavaScript |
|
CreateFeatureLayer( layerName, sConnectionString, lParentGroupID) |
C# |
|
ILayer61 CreateFeatureLayer( string layerName, string sConnectionString, int lParentGroupID) |
C++ |
|
HRESULT CreateFeatureLayer( BSTR layerName, BSTR sConnectionString, LONG_PTR lParentGroupID, ILayer61 ** 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.
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.