Determines the value of a server-side setting which restricts the maximum number of records that a ServiceChildLayer will return in response to the Query method.

Namespace:  ESRI.ArcGISExplorer.Mapping

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public int QueryFeatureLimit { get; }
Visual Basic (Declaration)
Public ReadOnly Property QueryFeatureLimit As Integer

Field Value

An integer value indicating the maximum number of features a ServiceChildLayer will return in response to a query.

Remarks

The QueryFeatureLimit is a server-side setting used by GIS server administrators to protect the GIS server from excessivly large requests. The limit, which can be any value zero or greater, restricts the maximum number of records that a ServiceChildLayer will return in response to the Query method.

The QueryFeatureLimit property should be used in conjunction with the QueryFeatureCount method to ensure that the WHERE clause does not produce a result set which exceeds this limit. For example, if the server-side setting is 1000, using the QueryFeatureLimit property will help you determine whether only 1000 features actually matched the query or whether the server-side limit was set to 1000 and just the first 1000 features were returned.

The default value for the ArcGIS Server setting mMaximum Number of Records Returned by Server is:

  • ArcGIS Server 9.X: 500
  • ArcGIS Server 10.X: 1000

If CanQuery is false this method will throw an ExplorerException.

Version Information: This member is supported from version 2.0.0.1500.

Examples

The code below demonstrates the process of connecting to a ServiceLayer and confirming that both the top level ServiceLayer and a specific ServiceChildLayer will support queries before then accessing the Columns, QueryFeatureLimit, and QueryFeatureCount members to ensure a valid query is executed against the ServiceChildLayer via the Query method. Finally, the example connects to the FeatureLayer datasource and gets the number of rows in the result FeatureLayer table.
CopyC#
{

  //Create a new ServiceConnectionProperties instance and populate with connection information
  ServiceConnectionProperties serviceConnProps = new ServiceConnectionProperties(ServiceType.MapServer,
      new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/services/Demographics"),
      "/ESRI_Census_USA");

  //Create a new ServiceLayer instance passing in the ServiceConnectionProperties 
  ServiceLayer serviceLayer = new ServiceLayer(serviceConnProps);

  //Check the ServiceLayer can Connect
  if (!serviceLayer.Connect())
    return;

  //Check this ServiceLayer supports queries
  if (!serviceLayer.CanQuery)
    return;

  //Get the "states" ServiceChildLayer on which we want to execute a query
  ServiceChildLayer serviceChildLayerStates = serviceLayer.FindByName("states") as ServiceChildLayer;

  //Check this ServiceChildlayer supports queries
  if (!serviceChildLayerStates.CanQuery)
    return;

  //Get the collection of columns for the ServiceChildLayer
  ColumnCollection columns = serviceChildLayerStates.Columns;

  //Create the WHERE clause
  string whereClause = string.Empty;

  //Check each column until the alias matches the intended query field
  foreach (Column column in columns)
  {
    //Use column members to confirm the the AliasName and data type
    if (column.AliasName == "POP2007" & column.Type == ColumnType.Integer)
    {
      //Populate the WHERE clause with matched column name, operator and value
      whereClause = column.Name + " > 10000000";
      break;
    }
  }

  //Check the WHERE clause
  if (whereClause == string.Empty)
    return;

  //Get the maximum number of records returnable from the service
  int queryFeatureLimit = serviceChildLayerStates.QueryFeatureLimit;

  //Get the number of features matching the WHERE clause
  int queryFeatureCount = serviceChildLayerStates.QueryFeatureCount(whereClause);

  //IMPORTANT: Check the feature count is not greater than the feature limit
  if (!(queryFeatureCount <= queryFeatureLimit))
    return;

  //Execute the Query method to get a new FeatureLayer containing the results
  FeatureLayer featureLayer = serviceChildLayerStates.Query(whereClause);

  //The FeatureLayer method must be called to access all FeatureLayer members
  if (!featureLayer.Connect())
    return;

  //Implement code to work with FeatureLayer (in this case get the number of rows)
  int numberOfResultFeatures = featureLayer.Table.GetRows().Count;

}
CopyVB.NET
'Create a new ServiceConnectionProperties instance and populate with connection information
Dim serviceConnProps As New ServiceConnectionProperties( _
ServiceType.MapServer, _
New Uri("http://sampleserver1.arcgisonline.com/ArcGIS/services/Demographics"), _
"/ESRI_Census_USA")

'Create a new ServiceLayer instance passing in the ServiceConnectionProperties 
Dim serviceLayer1 As New ServiceLayer(serviceConnProps)

'Check the ServiceLayer can Connect
If Not serviceLayer1.Connect() Then
  Return
End If

'Check this ServiceLayer supports queries  
If Not serviceLayer1.CanQuery Then
  Return
End If

'Get the "states" ServiceChildLayer on which we want to execute a query  
Dim serviceChildLayerStates As ServiceChildLayer = TryCast(serviceLayer1.FindByName("states"), ServiceChildLayer)

'Check this ServiceChildlayer supports queries  
If Not serviceChildLayerStates.CanQuery Then
  Return
End If

'Get the collection of columns for the ServiceChildLayer  
Dim columns As ColumnCollection = serviceChildLayerStates.Columns

'Create the WHERE clause  
Dim whereClause As String = String.Empty

'Check each column until the alias matches the intended query field  
For Each column As Column In columns

  'Use column members to confirm the the AliasName and data type  
  If column.AliasName = "POP2007" And column.Type = ColumnType.[Integer] Then

    'Populate the WHERE clause with matched column name, operator and value  
    whereClause = column.Name + " > 10000000"
    Exit For

  End If

Next

'Check the WHERE clause  
If whereClause = String.Empty Then
  Return
End If

'Get the maximum number of records returnable from the service  
Dim queryFeatureLimit As Integer = serviceChildLayerStates.QueryFeatureLimit

'Get the number of features matching the WHERE clause  
Dim queryFeatureCount As Integer = serviceChildLayerStates.QueryFeatureCount(whereClause)

'IMPORTANT: Check the feature count is not greater than the feature limit  
If Not (queryFeatureCount <= queryFeatureLimit) Then
  Return
End If

'Execute the Query method to get a new FeatureLayer containing the results  
Dim featureLayer As FeatureLayer = serviceChildLayerStates.Query(whereClause)

'The FeatureLayer method must be called to access all FeatureLayer members  
If Not featureLayer.Connect() Then
  Return
End If

'Implement code to work with FeatureLayer (in this case get the number of rows)  
Dim numberOfResultFeatures As Integer = featureLayer.Table.GetRows().Count

See Also