ESRI.ArcGIS.ADF.IMS
GetFeatureCount(Filter,SelectionBuffer) Method
See Also  Example Send Feedback
ESRI.ArcGIS.ADF.IMS.Carto.Layer Namespace > FeatureLayer Class > GetFeatureCount Method : GetFeatureCount(Filter,SelectionBuffer) Method




queryFilter
Filter that defines the attribute and spatial criteria for the query.
selectionBuffer
Buffer to be applied to features found with the filter. May be null (Nothing).
A function that returns the number of features in a query.

Syntax

Visual Basic (Declaration) 
Public Overloads Function GetFeatureCount( _
   ByVal queryFilter As Filter, _
   ByVal selectionBuffer As SelectionBuffer _
) As Integer
Visual Basic (Usage)Copy Code
Dim instance As FeatureLayer
Dim queryFilter As Filter
Dim selectionBuffer As SelectionBuffer
Dim value As Integer
 
value = instance.GetFeatureCount(queryFilter, selectionBuffer)
C# 
public int GetFeatureCount( 
   Filter queryFilter,
   SelectionBuffer selectionBuffer
)

Parameters

queryFilter
Filter that defines the attribute and spatial criteria for the query.
selectionBuffer
Buffer to be applied to features found with the filter. May be null (Nothing).

Return Value

The number of features that would be returned from the query on the layer.

Example

This example gets the count of features that match a query. It assumes an existing feature layer and a label control.
C#Copy Code
// Create a filter for the query - where clause in constructor
Filter filter = new Filter("POPULATION > 100000");
 
// Get feature count - using previously retrieved layer object; no selection buffer
int featureCount = myLayer.GetFeatureCount(filter, null);
 
// Display results - assume Label1 is a label control on page
Label1.Text = featureCount.toString() + " features found."
Visual BasicCopy Code
' Create a filter For the query - where clause In constructor
Dim filter As New Filter("POPULATION > 100000")
 
' Get feature count - using previously retrieved layer Object; no selection buffer
Dim featureCount As Integer = myLayer.GetFeatureCount(filter, null);
 
' Display results - assume Label1 Is a label control On page
Label1.Text = featureCount.toString() + " features found."

Remarks

This method returns the number of features that satisfy a query, optionally including a buffer. It does not actually return any records. If you need features returned, use Query().

The queryFilter parameter defines the selection on the layer. It can contain attribute and spatial criteria, including a buffer around user-supplied geometry. If no features are found with the queryFilter, then this method will return zero. The selectionBuffer will expand the selection to include an area surrounding any features found with the queryFilter.

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

© 2011 All Rights Reserved.