A function that returns the number of features in a query.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As FeatureLayer
Dim queryFilter As Filter
Dim selectionBuffer As SelectionBuffer
Dim globalEnvelope As Envelope
Dim value As Integer
value = instance.GetFeatureCount(queryFilter, selectionBuffer, globalEnvelope) |
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).
- globalEnvelope
- Envelope that surrounds all features found with the query, including any selection buffer.
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, and also gets the envelope around the features. 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");
// Declare envelope for out parameter
Envelope env = null;
// Get feature count - using previously retrieved layer object; no selection buffer
int featureCount = myLayer.GetFeatureCount(filter, null, env);
// Display results - assume Label1 is a label control on page
Label1.Text = featureCount.toString() + " features found.<br>" +
"Envelope of features: min x = " + String.Format("{0:#0.00}", env.XMin)
+ ", min y = " + String.Format("{0:#0.00}", env.YMin)
+ ", max x = " + String.Format("{0:#0.00}", env.XMax)
+ ", max y = " + String.Format("{0:#0.00}", env.YMax) |
Visual Basic | Copy Code |
---|
' Create a filter For the query - where clause In constructor
Dim filter As New Filter("POPULATION > 100000")
' Declare envelope For out parameter
Dim env As Envelope = null
' Get feature count - using previously retrieved layer Object; no selection buffer
Dim featureCount As Integer = myLayer.GetFeatureCount(filter, null, env);
' Display results - assume Label1 Is a label control On page
Label1.Text = featureCount.toString() + " features found.<br>" + _
"Envelope of features: min x = " + String.Format("{0:#0.00}", env.XMin) _
+ ", min y = " + String.Format("{0:#0.00}", env.YMin) _
+ ", max x = " + String.Format("{0:#0.00}", env.XMax) _
+ ", max y = " + String.Format("{0:#0.00}", env.YMax) |
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