![]() ![]() |
ESRI.ArcGIS.ADF.IMS | |
SelectionBuffer Class | |
Members Example See Also Send Feedback |
ESRI.ArcGIS.ADF.IMS.Carto.Layer Namespace : SelectionBuffer Class |

Visual Basic (Declaration) | |
---|---|
<SerializableAttribute()> Public Class SelectionBuffer Inherits Buffer |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As SelectionBuffer |
C# | |
---|---|
[SerializableAttribute()] public class SelectionBuffer : Buffer |
The example below selects cities with a population over one million that are within 100 kilometers of a selected river. First we get references to the source layer (rivers) and target layer (cities). Next we set up the filter for the source layer and the buffer for features that will be selected by the filter. The buffer object also specifies the target layer and an optional where-expression that narrows the selected set of cities. The query results for the selected cities are displayed in a standard .NET GridView web control. Compare this example with the one where the cities are highlighted on a map in FeatureLayer.CreateBufferSelectionLayer .
C# | ![]() |
---|---|
// Get a reference to the buffer source layer // -- a buffer is constructed around features in this layer ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer originalLayer = (ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer) mapView.Layers.FindByName("Rivers"); // Get a reference to the target layer // -- features in this layer will be highlighted ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer targetLayer = (ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer) mapView.Layers.FindByName("Cities"); // Create a filter and a selection buffer for the query ESRI.ArcGIS.ADF.IMS.Carto.Layer.Filter queryFilter = new ESRI.ArcGIS.ADF.IMS.Carto.Layer.Filter("NAME = 'Mekong'"); ESRI.ArcGIS.ADF.IMS.Carto.Layer.SelectionBuffer selectionBuffer = new ESRI.ArcGIS.ADF.IMS.Carto.Layer.SelectionBuffer(); selectionBuffer.Distance = 100.0; selectionBuffer.Units = ESRI.ArcGIS.ADF.IMS.Carto.Layer.BufferUnits.Kilometers; selectionBuffer.WhereExpression = "POPULATION > 1000000"; selectionBuffer.TargetLayer = targetLayer; // Create the QueryParameters and query the layer ESRI.ArcGIS.ADF.IMS.Carto.Layer.QueryParameters qParams; qParams = new ESRI.ArcGIS.ADF.IMS.Carto.Layer.QueryParameters(queryFilter, selectionBuffer); ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureTable queryResults; queryResults = originalLayer.Query(qParams); // Display any results in a GridView control if (queryResults.Rows.Count > 0) { GridView1.DataSource = queryResults; GridView1.DataBind(); } else { Label1.Text = "No features found."; } |
Visual Basic | ![]() |
---|---|
' Get a reference to the buffer source layer ' -- a buffer is constructed around features in this layer Dim originalLayer As ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer = _ CType(mapView.Layers.FindByName("Rivers"), _ ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer) ' Get a reference to the target layer ' -- features in this layer will be highlighted Dim targetLayer As ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer = _ CType(mapView.Layers.FindByName("Cities"), _ ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer) ' Create a filter and a selection buffer for the query ESRI.ArcGIS.ADF.IMS.Carto.Layer.Filter queryFilter = New ESRI.ArcGIS.ADF.IMS.Carto.Layer.Filter("NAME = 'Mekong'") Dim selectionBuffer As New _ ESRI.ArcGIS.ADF.IMS.Carto.Layer.SelectionBuffer() selectionBuffer.Distance = 100.0 selectionBuffer.Units = ESRI.ArcGIS.ADF.IMS.Carto.Layer.BufferUnits.Kilometers selectionBuffer.WhereExpression = "POPULATION > 1000000" selectionBuffer.TargetLayer = targetLayer ' Create the QueryParameters and query the layer Dim qParams As ESRI.ArcGIS.ADF.IMS.Carto.Layer.QueryParameters qParams = New ESRI.ArcGIS.ADF.IMS.Carto.Layer.QueryParameters(queryFilter, selectionBuffer) Dim queryResults As ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureTable queryResults = originalLayer.Query(qParams) ' Display any results in a GridView control If queryResults.Rows.Count > 0 Then GridView1.DataSource = queryResults GridView1.DataBind() Else Label1.Text = "No features found." End If |
A SelectionBuffer is used to select features within some distance of another set of features. The buffer selection may be displayed, as in FeatureLayer.CreateBufferSelectionLayer. Or the attribute data may be retrieved with FeatureLayer.Query.
The features are selected from the TargetLayer by this procedure:
- Features are selected from the FeatureLayer in which the buffer is used. This selection is done using a Filter applied during the creation of the buffer layer or when performing the query.
- These features are buffered using the properties of the SelectionBuffer, including Distance and Units.
- Features within the buffer distance in the TargetLayer are selected. These features are filtered by the WhereExpression, if set.
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