Creates a selection layer based on the current FeatureLayer, and selects the features near a given point.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As FeatureLayer
Dim point As Point
Dim expandPercentage As Double
Dim selectionRenderer As Renderer
Dim newLayerID As String
Dim value As FeatureLayer
value = instance.CreateSelectionLayer(point, expandPercentage, selectionRenderer, newLayerID) |
Parameters
- point
- Point location for selecting features.
- expandPercentage
- Percentage-based tolerance to determine the size of the envelope created around the map-point.
- selectionRenderer
- Renderer of the selection layer to be created.
- newLayerID
- ID of the selection layer to be created.
Return Value
Created selection layer.
Example
The following example selects countries near a point, and highlights them on the map. A point is defined as the center of selection, and an expand percentage is defined. A renderer with symbol is created to highlight the point features. The selection layer is created with point, expandPercentage and renderer, and is added to the map. The example assumes an existing MapView object.
C# | Copy Code |
---|
// Get a reference to the layer
FeatureLayer originalLayer =
(FeatureLayer)mapView.Layers.FindByName("Countries");
// Create geometry for the selection
ESRI.ArcGIS.ADF.IMS.Geometry.Point selectionPoint =
new ESRI.ArcGIS.ADF.IMS.Geometry.Point(25, 45);
double bufferPercentage = 1.0;
// Create a renderer for the selected features
SimpleFillSymbol selSymbol =
new SimpleFillSymbol(System.Drawing.Color.Red,
System.Drawing.Color.Red, PolygonFillType.FDiagonal);
SimpleRenderer selRenderer = new SimpleRenderer(selSymbol);
// Create the selection layer and add it to the map
FeatureLayer selectionLayer =
originalLayer.CreateSelectionLayer(selectionPoint,
bufferPercentage, selRenderer, "SelectedCountry");
mapView.Layers.Add(selectionLayer);
Image1.ImageUrl = mapView.Draw().Url; |
Visual Basic | Copy Code |
---|
' Get a reference to the layer
Dim originalLayer As FeatureLayer = _
CType(mapView.Layers.FindByName("Countries"), FeatureLayer)
' Create geometry for the selection
Dim selectionPoint As New ESRI.ArcGIS.ADF.IMS.Geometry.Point(25, 45)
Dim bufferPercentage As Double = 1.0
' Create a renderer for the selected features
Dim selSymbol As New SimpleFillSymbol(System.Drawing.Color.Red,
System.Drawing.Color.Red, PolygonFillType.FDiagonal);
Dim selRenderer As New SimpleRenderer(selSymbol)
' Create the selection layer and add it to the map
Dim selectionLayer As FeatureLayer = _
originalLayer.CreateSelectionLayer(selectionPoint, _
bufferPercentage, selRenderer, "SelectedCountry")
mapView.Layers.Add(selectionLayer)
Image1.ImageUrl = mapView.Draw().Url |
Remarks
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also