ESRI.ArcGIS.ADF.IMS
SelectionBuffer Class
Members  Example  See Also 
ESRI.ArcGIS.ADF.IMS.Carto.Layer Namespace : SelectionBuffer Class




A type of buffer used for selecting features within a layer. This buffer is not displayed.

Object Model


Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class SelectionBuffer 
   Inherits Buffer
Visual Basic (Usage)Copy Code
Dim instance As SelectionBuffer
C# 
[SerializableAttribute()]
public class SelectionBuffer : Buffer 

Example

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#Copy Code
// 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 BasicCopy Code
' 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

Remarks

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:

  1. 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.
  2. These features are buffered using the properties of the SelectionBuffer, including Distance and Units.
  3. Features within the buffer distance in the TargetLayer are selected. These features are filtered by the WhereExpression, if set.

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.ADF.IMS.Carto.Layer.Buffer
      ESRI.ArcGIS.ADF.IMS.Carto.Layer.SelectionBuffer

See Also

© 2010 All Rights Reserved.