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>

List of all members.

Public Member Functions

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

Static Public Member Functions

(id) + query

Properties

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

Member Function Documentation

- (void) decodeWithJSON: (NSDictionary *)  json   [optional, inherited]

Decode object from JSON representation.

Parameters:
json The JSON representation of the object to be decoded.
Since:
1.0
- (NSDictionary *) encodeToJSON   [optional, inherited]

Encode and return JSON representation for object.

Returns:
JSON representation of object.
Since:
1.0
- (id) initWithJSON: (NSDictionary *)  json   [optional, inherited]

Initialize and return object from JSON representation.

Parameters:
json The JSON representation of the object to be created.
Returns:
Object decoded from JSON representation.
Since:
1.0
+ (id) query  

Initialize an autoreleased Query object with defaults.

Returns:
A new, autoreleased, query object.
Since:
1.0

Property Documentation

- (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.

Since:
1.0
- (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.

Availability:
This feature is only available with services from ArcGIS Server 10.0 or above
Since:
1.0
- (NSArray*) objectIds [read, write, retain]

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*) 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.

Since:
1.0
- (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.

Since:
1.0
- (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
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 section of this document 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 [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.

Since:
1.0
- (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.

Since:
1.0
- (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.

Since:
1.0
- (AGSTimeExtent*) timeExtent [read, write, retain]

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 [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.

Since:
1.0