Represents a layer based on vector data stored in a shapefile or geodatabase.

Namespace:  ESRI.ArcGISExplorer.Mapping

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public sealed class FeatureLayer : Layer
Visual Basic (Declaration)
Public NotInheritable Class FeatureLayer _
	Inherits Layer

Remarks

The layer classes are a subset of MapItems that reference geographic data. A FeatureLayer enables vector data to be added to the map and displayed by the ArcGIS Explorer application.

Vector data can be stored in a shapefile or geodatabase feature class as a set of features that share a common geometry type, for example a set of lines that represent roads. When a connected FeatureLayer is added to the map, the related data is draped over the basemap (and any existing layers in the map). The layer must be in a connected state before data can be displayed. There are two ways to connect a layer to data:

1. Instantiate a FeatureLayer and connect explicitly.

  • Create a new FeatureLayer, populate the DataSourceProperties property and call FeatureLayer.Connect()
  • A constructor is also provided to allow you to specify the data source properties when you instantiate a layer. If the properties specified are incorrect, the feature layer will remain disconnected but no exception will be thrown; use the ConnectionStatus property to diagnose why a layer could not be connected.
  • In the context of FeatureLayer, the DataSourceProperties class encapsulates connection information for three types of data source: shapefile, file geodatabase feature class and ArcSDE geodatabase feature class. There are three parameterized constructors that enable you to instantiate a DataSourceProperties object for each type of data source: a shapefile requires only a path to the file (.shp), a file geodatabase requires a path to the geodatabase and a feature class name, and an ArcSDE geodatabase requires an ArcSDEConnectionProperties and a feature class name.

2. Instantiate and connect with a single method call.

  • Use the static methods prefixed with "Open" to both instantiate a FeatureLayer and connect to its underlying data source with a single method call.
  • There are four static methods that are named according to the type of data source you are referencing: OpenArcSDETable, OpenFileGeodatabaseTable, OpenFromTable, OpenShapefile.
  • The parameters for each method indicate the connection information required when connecting to the type of data source, for example the OpenArcSDETable method requires connection properties for an ArcSDE geodatabase and the name of the feature class.
  • If successful the Open methods return a connected FeatureLayer object. In contrast to the Connect method, an exception will be thrown if the connection parameters specified are incorrect. Therefore it is a good idea to wrap a call to the Open method with a try... catch block if you are unsure of the data source to which you are connecting.
  • The connection information you specify will be stored in the FeatureLayer.DataSourceProperties property; the DataSourceProperties class encapsulates connection information for the data source types: shapefile, file geodatabase feature class and ArcSDE geodatabase feature class.

If a FeatureLayer is added to the map in an unconnected state, no data will be displayed. The layer will still appear in the ArcGIS Explorer contents window with an exclamation mark to indicate the layer is not connected.

Once connected, you can access data dependent properties such as the geographical extent of the layer. It is also possible to retrieve the underlying data for the FeatureLayer using the Table property. The symbols used to represent the geometry is not usually stored alongside the geographical features, but rather specified at the layer level. FeatureLayer.Renderer allows you to specify a symbol for the vector data.

Inheritance Hierarchy

System..::.Object

  ESRI.ArcGISExplorer.Mapping..::.MapItem

    ESRI.ArcGISExplorer.Mapping..::.Layer

      ESRI.ArcGISExplorer.Mapping..::.FeatureLayer

See Also