10.2.5: AGSQuery Class Reference
10.2.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
AGSQuery Class Reference

Description

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.

Defined in:
AGSQueryTask.h ( ArcGIS library)

Since
1.0
Inheritance diagram for AGSQuery:
<AGSCoding>

Instance Methods

(void) - decodeWithJSON:
 
(NSDictionary *) - encodeToJSON
 
(id) - initWithJSON:
 

Class Methods

(id) + query
 

Properties

AGSGeometrygeometry
 
NSArray * groupByFieldsForStatistics
 
double maxAllowableOffset
 
NSArray * objectIds
 
NSArray * orderByFields
 
NSArray * outFields
 
AGSSpatialReferenceoutSpatialReference
 
NSArray * outStatistics
 
NSString * relationParam
 
BOOL returnGeometry
 
AGSSpatialRelationship spatialRelationship
 
NSString * text
 
AGSTimeExtenttimeExtent
 
NSString * where
 
NSString * whereClause
 

Method Documentation

- (void) decodeWithJSON: (NSDictionary *)  json
optionalinherited

Decode object from JSON representation.

Parameters
jsonThe JSON representation of the object to be decoded.
Since
1.0
- (NSDictionary *) encodeToJSON
optionalinherited

Encode and return JSON representation for object.

Returns
JSON representation of object.
Since
1.0
- (id) initWithJSON: (NSDictionary *)  json
optionalinherited

Initialize and return object from JSON representation.

Parameters
jsonThe JSON representation of the object to be created.
Returns
Object decoded from JSON representation.
Since
1.0

Reimplemented in AGSWebMapFeatureCollection.

+ (id) query

Initialize an autoreleased Query object with defaults.

Returns
A new, autoreleased, query object.
Since
1.0

Property Documentation

- (AGSGeometry*) geometry
readwritenonatomicstrong

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.

Since
1.0
- (NSArray*) groupByFieldsForStatistics
readwritenonatomiccopy

One or more field by which the statistics must be calculated and grouped. It is an array of strings, where each string represents a field name. This property works together with outStatistics;

Availability:
This feature is only available with services from ArcGIS Server 10.1 or above

Since
10.1.1
- (double) maxAllowableOffset
readwritenonatomicassign

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.

Availability:
This feature is only available with services from ArcGIS Server 10.0 or above

Since
1.0
- (NSArray*) objectIds
readwritenonatomiccopy

The IDs of features that the query should be restricted to.

Availability:
This feature is only available with services from ArcGIS Server 10 or above

Since
1.0
- (NSArray*) orderByFields
readwritenonatomiccopy

Fields by which the results need to be ordered. It is an array of strings, where each string contains a field name followeb by the sort order (ASC or DESC). For example, [ "STATE_NAME ASC", "POP1990 DESC"]. Note, the service being queried must support advanced queries.

Availability:
This feature is only available with services from ArcGIS Server 10.1 or above

Since
10.1.1
- (NSArray*) outFields
readwritenonatomiccopy

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.

Since
1.0
- (AGSSpatialReference*) outSpatialReference
readwritenonatomicstrong

The spatial reference in which result geometries are to be returned. If not specified, geometries are returned in the spatial reference of the service.

Since
1.0
- (NSArray*) outStatistics
readwritenonatomiccopy

Definitions, as an array of AGSOutStatistic objects, for one or more field-based statitics to be calculated. Note, the service being queried must support calculating statistics.

Availability:
This feature is only available with services from ArcGIS Server 10.1 or above

Since
10.1.1
- (NSString*) relationParam
readwritenonatomiccopy

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
1InteriorInterior
2InteriorBoundary
3InteriorExterior
4BoundaryInterior
5BoundaryBoundary
6BoundaryExterior
7ExteriorInterior
8ExteriorBoundary
9ExteriorExterior

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 for more information.

You must set spatialRelationship to AGSSpatialRelationshipRelation when specifying this parameter.

Availability:
This feature is only available with services from ArcGIS Server 10 or above

Since
1.0
- (BOOL) returnGeometry
readwritenonatomicassign

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.

Since
1.0
- (AGSSpatialRelationship) spatialRelationship
readwritenonatomicassign

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.

Since
1.0
- (NSString*) text
readwritenonatomiccopy

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.

Since
1.0
- (AGSTimeExtent*) timeExtent
readwritenonatomicstrong

Specify a time extent for the query.

Availability:
This feature is only available with services from ArcGIS Server 10.0 or above

Since
1.0
- (NSString*) where
readwritenonatomiccopy

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.

Since
1.0
Deprecated:
Deprecated at 10.2.5. Please use AGSQuery::whereClause instead.
- (NSString*) whereClause
readwritenonatomiccopy

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.

Since
10.2.5