ESRI.ArcGIS.ADF.IMS
FeatureLayer Constructor(String,FeatureDataset)
See Also  Example
ESRI.ArcGIS.ADF.IMS.Carto.Layer Namespace > FeatureLayer Class > FeatureLayer Constructor : FeatureLayer Constructor(String,FeatureDataset)




id
ID of the constructed FeatureLayer. This value must be unique if the constructed layer is to be added to a LayerCollection.
dataset
Dataset of the constructed FeatureLayer.
Constructs a FeatureLayer object.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal id As String, _
   ByVal dataset As FeatureDataset _
)
Visual Basic (Usage)Copy Code
Dim id As String
Dim dataset As FeatureDataset
 
Dim instance As FeatureLayer(id, dataset)
C# 
public FeatureLayer( 
   string id,
   FeatureDataset dataset
)

Parameters

id
ID of the constructed FeatureLayer. This value must be unique if the constructed layer is to be added to a LayerCollection.
dataset
Dataset of the constructed FeatureLayer.

Example

The following example creates a new FeatureLayer using a new workspace and data set. It sets a renderer for the new layer, then adds the layer to the map.
C#Copy Code
// Create a new FeatureLayer from a new ArcSDE workspace and data set 

SdeWorkspace newSdeWS = new SdeWorkspace("sde_ws_1", "mySdeServer", "port:5151", "gis", "gis"); 

FeatureDataset newDataset = new FeatureDataset("MyInst.MyDB.Capitals", newSdeWS); 

ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer dynamicLayer  

    = new ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer("capitals", newDataset); 

  

// Assign a new renderer to the dynamic layer 

SimpleRenderer capitalsRenderer = SimpleRenderer.Create(FeatureType.Point, System.Drawing.Color.Blue); 

dynamicLayer.Renderer = capitalsRenderer; 

  

// Add the dynamic layer to the map and draw the map 

mapView.Layers.Add(dynamicLayer); 

Image1.ImageUrl = mapView.Draw().Url; 

    
Visual BasicCopy Code
' Create a new FeatureLayer from a new ArcSDE workspace and Data Set

Dim newSdeWS As New SdeWorkspace("sde_ws_1", "mySdeServer", "port:5151", "map", "map")

Dim newDataset As New FeatureDataset("MyInst.MyDB.Capitals", newSdeWS)

Dim dynamicLayer As New ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer("capitals", newDataset)



' Assign a new renderer to the dynamic layer

Dim capitalsRenderer As New SimpleRenderer.Create(FeatureType.Point, System.Drawing.Color.Blue)

dynamicLayer.Renderer = capitalsRenderer



' Add the dynamic layer to the map and draw the map

mapView.Layers.Add(dynamicLayer)

Image1.ImageUrl = mapView.Draw().Url

Remarks

This method enables creation of a dynamic layers, which are new map layers based on spatial data not currently used in the map service. To add a new layer not yet in the map service, you must define the FeatureDataset, which specifies the name of the data layer. In the FeatureDataset you must also define the workspace, which can be an existing workspace in the map service (NamedWorkspace) or a new workspace (SdeWorkspace or ShapeWorkspace).

The layer ID can be any combination of alpha and numeric characters.

Dynamic layers are not supported with ArcMap image services.

See Also

© 2010 All Rights Reserved.