Instances of this class represent parameters for executing queries with
AGSQueryTask. Parameters define criteria for the query and provide options for how the results should be returned.
All parameters related to geometry and spatial queries will be ignored when querying tables.
Public Member Functions
|(NSDictionary *)||- encodeToJSON|
Static Public Member Functions
|- (void) decodeWithJSON:||(NSDictionary *)||json||
Decode object from JSON representation.
|json||The JSON representation of the object to be decoded.|
|- (NSDictionary *) encodeToJSON||
Encode and return JSON representation for object.
|- (id) initWithJSON:||(NSDictionary *)||json||
Initialize and return object from JSON representation.
|json||The JSON representation of the object to be created.|
|+ (id) query|
Initialize an autoreleased Query object with defaults.
|- (AGSGeometry*) geometry
|- (double) maxAllowableOffset
The maximum allowable offset used for generalizing geometries returned by the query operation. The default is 0. If 0 is specified the value is not passed to the server in a query. The offset is in the units of the
outSpatialReference. If a
outSpatialReference is not defined, the spatial reference of the service is used.
|- (NSArray*) objectIds
The IDs of features that the query should be restricted to.
|- (NSArray*) outFields
Attribute fields to be included for the result features or records. To include geometry information in the results, use returnGeometry. You must use the actual field names rather than the field aliases. As a best practice, you should try to limit the fields to only those you expect to use. The fewer fields you include, the faster the response will be.
This parameter must be specified. You can use the wildcard "*" to include all fields.
If a table is being queried, results will not contain geometries.
|- (AGSSpatialReference*) outSpatialReference
The spatial reference in which result geometries are to be returned. If not specified, geometries are returned in the spatial reference of the service.
|- (NSString*) relationParam
The spatial relate function to be applied on the query
geometry while performing the query. For example "FFFTTT****". It is a 9 character string describing a custom spatial relationship, something that is not possible with spatialRelationship . A spatial relationship is defined by the intersections between the boundary, interior, and exterior of the query geometry and the result geometry.
Interior: The interior of a shape is defined as the entire shape minus its boundary. All shapes have interior.
Boundary: Linear and area shapes have boundaries, but point shapes do not. The boundary of linear shapes consists of the end points of all linear parts. The boundary of area shapes consists of the linear boundary of the polygon shell(s).
Exterior: The area outside a shape. All shapes have an exterior.
The 9 character string is used to specify whether the intersection of each of the elements in following table is true (T), false (F), or not tested (*).
|Query Geometry||Result Geometry|
Thus, in "FFFTTT****", relationships 1-3 must be false, relationships 4-6 must be true, and relationships 7-9 are not tested.
Refer to the Spatial Relate Function section of this document for more information.
You must set spatialRelationship to
AGSSpatialRelationshipRelation when specifying this parameter.
|- (BOOL) returnGeometry
YES, result features will include their geometry. This is needed when you want to display the features on the map. Default is
NO to get better performance since geometries make up a significant portion of the response. If a table is being queried, results will not contain geometries.
|- (AGSSpatialRelationship) spatialRelationship
The spatial constraint that needs to be applied on the query geometry. Possible values include
You can also specify a custom spatial constraint in relationParam by setting this parameter to
|- (NSString*) text
The text to be searched in the layer's primary display field. The search is case-sensitive. The display field for a layer is listed in the Services Directory.
This parameter is a shorthand for a where clause of the form <displayField> like '%<text>'. It is ignored if where clause is specified.
|- (AGSTimeExtent*) timeExtent
Specify a time extent for the query.
|- (NSString*) where
A SQL where clause for the query. If the where clause includes dates, they must be correctly formatted based on the geodatabase datasource used in the service. Refer to this document for date formats expected by different datasources.