AGSQueryTask Class Reference


Description

This task performs structured queries on a layer of ArcGIS Server Map Service, Image Service, or Feature Service. For Map and Feature services, the query can also be performed on a table. Queries can be based on SQL expressions, spatial relationships, or time extents.

A query task needs a URL to a REST resource that represents a layer in a Map, Image, or Feature service. For example, http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5

See also:
Conceptual Doc: Using a Query Task
Sample: Query Task
Since:
1.0
Inheritance diagram for AGSQueryTask:
AGSTask <AGSSecuredResource>

List of all members.

Public Member Functions

(NSOperation *) - executeFeatureCountWithQuery:
(NSOperation *) - executeForIdsWithQuery:
(NSOperation *) - executeWithQuery:
(NSOperation *) - executeWithRelationshipQuery:
(id) - initWithURL:
(id) - initWithURL:credential:

Static Public Member Functions

(id) + queryTaskWithURL:
(id) + queryTaskWithURL:credential:

Properties

AGSCredentialcredential
id< AGSQueryTaskDelegatedelegate
NSURL * URL

Member Function Documentation

- (NSOperation *) executeFeatureCountWithQuery: (AGSQuery *)  query  

Executes a query against the layer resource pointed by the url. It relies on the Query operation of the REST resource.

The query returns only a feature count of records matching the specified criteria.

The delegate will be notified when the operation completes or if an error is encountered.

Parameters:
query Specifies the criteria for the query.
Returns:
NSOperation for current execute request.
Since:
1.0
Availability:
This feature is only available with services from ArcGIS Server 10 or above
See also:
AGSQueryTaskDelegate
- (NSOperation *) executeForIdsWithQuery: (AGSQuery *)  query  

Executes a query against the layer resource pointed by the url. It relies on the Query operation of the REST resource.

The query returns only IDs of records matching the specified criteria. This is useful if you want to implement paging for results or if you want to only fetch result details on demand. Unlike executeWithQuery: , there is no limit on the number of results returned by this query.

The delegate will be notified when the operation completes or if an error is encountered.

Parameters:
query Specifies the criteria for the query.
Returns:
NSOperation for current execute request.
Since:
1.0
Availability:
This feature is only available with services from ArcGIS Server 10 or above
See also:
AGSQueryTaskDelegate
- (NSOperation *) executeWithQuery: (AGSQuery *)  query  

Executes a query against the layer resource pointed by the url. It relies on the Query operation of the REST resource.

The query returns records matching the specified criteria. The records could be features, if the service layer represents a layer. Or the records could be simple records (without geometry) if the service layer represents a table. The delegate will be notified when the operation completes or if an error is encountered.

The number of results returned by the query is limited by the service's configuration.

Parameters:
query Specifies the criteria for the query.
Returns:
NSOperation for current execute request.
Since:
1.0
See also:
AGSQueryTaskDelegate
- (NSOperation *) executeWithRelationshipQuery: (AGSRelationshipQuery *)  query  

Executes a query against the layer resource pointed by the url. It relies on the Query Related Records operation of the REST resource.

The query returns records that are related to the given set of features. The related records could be features, if the service layer is related to a layer. Or the related records could be simple records (wihtout geometry) if the service layer is related to a table.

The delegate will be notified when the operation completes or if an error is encountered.

Parameters:
query Specifies the criteria for the query.
Returns:
NSOperation for current execute request.
Since:
1.0
Availability:
This feature is only available with services from ArcGIS Server 10 or above
See also:
AGSQueryTaskDelegate
- (id) initWithURL: (NSURL *)  url  

Initialize the task.

Parameters:
url URL to a task resource in the ArcGIS Server REST Services Directory.
Returns:
A new task object.
Since:
1.0
- (id) initWithURL: (NSURL *)  url
credential: (AGSCredential *)  cred 

Initialize the task with a URL and credential to a secured resource.

Parameters:
url URL to a task resource in the ArcGIS Server REST Services Directory.
cred AGSCredential used to access secure resource.
Returns:
A new task object.
Since:
1.0
+ (id) queryTaskWithURL: (NSURL *)  url  

Initialize an autoreleased query task.

Parameters:
url URL to a layer resource in the ArcGIS Server REST Services Directory.
Returns:
A new, autoreleased, query task object.
Since:
1.0
+ (id) queryTaskWithURL: (NSURL *)  url
credential: (AGSCredential *)  cred 

Initialize autoreleased query task.

Parameters:
url URL to a layer resource in the ArcGIS Server REST Services Directory.
cred AGSCredential used to access the secured service.
Returns:
A new, autoreleased, query task object.
Since:
1.0

Property Documentation

- (AGSCredential*) credential [read, write, copy, inherited]

The credential to be used to access secured resources.

Since:
1.0

Reimplemented from <AGSSecuredResource>.

- (id<AGSQueryTaskDelegate>) delegate [read, write, assign]

Delegate to be notified when the task completes successfully or returns an error.

Since:
1.0
- (NSURL*) URL [read, copy, inherited]

URL to a task resource in the ArcGIS Server REST Services Directory.

Since:
1.0