Creates a selection layer based on the current FeatureLayer, and selects the features that intersect a given geometry.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As FeatureLayer
Dim geometry As Geometry
Dim selectionRenderer As Renderer
Dim newLayerID As String
Dim value As FeatureLayer
value = instance.CreateSelectionLayer(geometry, selectionRenderer, newLayerID) |
Parameters
- geometry
- Features that intersect this geometry will be selected.
- 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 cities within an envelope and highlights them on the map. An envelope is created as the selection geometry, and a renderer with symbol is created to highlight the point features. The selection layer is created with the geometry 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("Cities");
// Create geometry for the selection
Envelope selectionGeometry = new Envelope(20, 40, 25, 45);
// Create a renderer for the selected features
SimpleMarkerSymbol selSymbol = new SimpleMarkerSymbol(System.Drawing.Color.Red, 16);
SimpleRenderer selRenderer = new SimpleRenderer(selSymbol);
// Create the selection layer and add it to the map
FeatureLayer selectionLayer =
originalLayer.CreateSelectionLayer(selectionGeometry, selRenderer, "SelectedCities");
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("Cities"), FeatureLayer)
' Create geometry for the selection
Dim selectionGeometry As New Envelope(20, 40, 25, 45)
' Create a renderer For the selected features
Dim selSymbol As New SimpleMarkerSymbol(System.Drawing.Color.Red, 16)
Dim selRenderer As New SimpleRenderer(selSymbol)
' Create the selection layer And add it To the map
Dim selectionLayer As FeatureLayer = _
originalLayer.CreateSelectionLayer(selectionGeometry, selRenderer, "SelectedCities")
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