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 | |
(void) | - decodeWithJSON: |
(NSDictionary *) | - encodeToJSON |
(id) | - initWithJSON: |
Static Public Member Functions | |
(id) | + query |
Properties | |
AGSGeometry * | geometry |
double | maxAllowableOffset |
NSArray * | objectIds |
NSArray * | outFields |
AGSSpatialReference * | outSpatialReference |
NSString * | relationParam |
BOOL | returnGeometry |
AGSSpatialRelationship | spatialRelationship |
NSString * | text |
AGSTimeExtent * | timeExtent |
NSString * | where |
- (void) decodeWithJSON: | (NSDictionary *) | json | [optional, inherited] |
Decode object from JSON representation.
json | The JSON representation of the object to be decoded. |
- (NSDictionary *) encodeToJSON | [optional, inherited] |
Encode and return JSON representation for object.
- (id) initWithJSON: | (NSDictionary *) | json | [optional, inherited] |
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 [read, write, retain] |
The geometry to use while performing a spatial query. Valid geometry types are AGSEnvelope
, AGSPoint
, AGSMultipoint
, AGSPolygon
, and AGSPolyline
. Results of the query will include only those features which conform to the specified spatialRelationship
with this geometry.
- (double) maxAllowableOffset [read, write, assign] |
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 [read, write, retain] |
The IDs of features that the query should be restricted to.
- (NSArray*) outFields [read, write, retain] |
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 [read, write, retain] |
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 [read, write, retain] |
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 | |
1 | Interior | Interior |
2 | Interior | Boundary |
3 | Interior | Exterior |
4 | Boundary | Interior |
5 | Boundary | Boundary |
6 | Boundary | Exterior |
7 | Exterior | Interior |
8 | Exterior | Boundary |
9 | Exterior | Exterior |
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 [read, write, assign] |
If 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 [read, write, assign] |
The spatial constraint that needs to be applied on the query geometry. Possible values include
AGSSpatialRelationshipIntersects
AGSSpatialRelationshipContains
AGSSpatialRelationshipCrosses
AGSSpatialRelationshipEnvelopeIntersects
AGSSpatialRelationshipIndexIntersects
AGSSpatialRelationshipOverlaps
AGSSpatialRelationshipTouches
AGSSpatialRelationshipWithin
AGSSpatialRelationshipRelation
You can also specify a custom spatial constraint in relationParam by setting this parameter to AGSSpatialRelationshipRelation
.
- (NSString*) text [read, write, retain] |
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 [read, write, retain] |
Specify a time extent for the query.
- (NSString*) where [read, write, retain] |
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.