Query Layer Activity

Description

The Query Layer activity executes a query operation on a layer resource of a map service exposed by the ArcGIS Server REST API.

Usage

You may need to query an ArcGIS Map Service. You could use the Query Layer activity to perform searches based on user input using the Display Form activity.

Offline Support

In order for this activity to work when the device is offline, the application must run in the Geocortex Mobile App Framework with an offline map that includes the layer.

Geocortex Mobile App Framework does not support the following inputs:

Inputs

Url

Optional

Type: String

The URL to the ArcGIS layer to query. Either Url or Layer is required.

For example, http://server/arcgis/rest/services/<serviceName>/MapServer/<layerOrTableId>.

Layer

Optional

Type: esri.Layer (3.x, 4.x)*

The ArcGIS feature layer. Either Url or Layer is required.

Where

Optional

Type: String

A where clause of the query.

Any legal SQL where clause operating on the fields in the layer is allowed. For example, POP2000 > 35000.

Geometry

Optional

Type: esri.Geometry (3.x, 4.x)*

The geometry to apply to the spatial filter.

Return Geometry

Optional

Type: Boolean

If true, each feature in the resulting Feature Set includes the geometry.

Set to false (default) if you do not plan to include highlighted features on a map since the geometry takes up a significant portion of the response.

Output Spatial Reference

Optional

Type: Number | String | esri.SpatialReference (3.x, 4.x)*

The spatial reference for the returned geometry.

If not specified, the geometry is returned in the spatial reference of the service being queried.

Output Fields

Optional

Type: String | String[]

Attribute fields to include in the Feature Set.

By default only the display field of the service is included.

To return all fields, specify the wildcard '*' as the value of this parameter.

Order By Fields

Optional

Type: String | String[]

The sorting order for the results.

Specify ASC (ascending) or DESC (descending) after the field name to control the order.

The default order is ASC. Order By Fields is only supported on dynamic layers and tables where supportsAdvancedQueries is true.

Requires ArcGIS Server 10.1+.

Return Distinct Values

Optional

Type: Boolean

If true, the result will contain distinct values based on the fields specified in the Output Fields property.

Only applies if supportsAdvancedQueries property of the layer is true.

Requires ArcGIS Server 10.1.1+.

Geodatabase Version

Optional

Type: String

The version of the geodatabase on which the query will be performed.

This property applies to feature services.

Requires ArcGIS Server 10.0+.

Distance

Optional

Type: Number

Distance to buffer input geometry.

Query results will include features within the distance specified of the query geometry.

Valid only for feature services hosted on ArcGIS Online.

Geometry Precision

Optional

Type: Number

The number of decimal places for the geometries returned by the query operation.

Group By Fields For Statistics

Optional

Type: String | String[]

One or more field names that will be used to group the statistics.

This is only valid when outStatistics has been defined.

Requires ArcGIS Server 10.1+.

Max Allowable Offset

Optional

Type: Number

The maximum allowable offset to be used for generalizing geometries returned by the query operation.

The offset is in the units of Output Spatial Reference.

If Output Spatial Reference is not defined, the spatial reference of the service is used.

Requires ArcGIS Server 10+.

Multipatch Option

Optional

Type: String

Parameter to support querying feature services whose data source is a multipatch featureclass.

Known values: xyFootprint.

Count

Optional

Type: Number

Number of features to retrieve.

Should be used in conjunction with query.start.

Use this to implement paging and retrieve "pages" of results when querying.

If not provided, but an instance of Query has a "start" property, num defaults to 10.

Valid only for feature services hosted on ArcGIS Online.

Ids

Optional

Type: Number | Number[]

An object ID or an array of object IDs to query for.

Out Statistics

Optional

Type: esri.StatisticDefinition (3.x, 4.x)* | esri.StatisticDefinition[] (3.x, 4.x)*

The definitions for one or more field-based statistics to be calculated.

Only supported on layers/tables where supportsStatistics is set to true.

If Out Statistics is specified, the only other properties that will be used are Group By Fields For Statistics, Order By Fields, Text, Time Extent, and Where.

Requires ArcGIS Server 10.1+.

Pixel Size

Optional

Type: esri.Symbol (3.x, 4.x)*

Specify the pixel level to be identified on the X and Y axis.

Defaults to the base resolution of the dataset if not specified.

Applicable only to Image Service layers.

Quantization Parameters

Optional

Type: esri.QueryQuantizationParameters (3.x, 4.x)*

Used to project the geometry onto a virtual grid, likely representing pixels on the screen.

Valid only for services hosted on ArcGIS Online.

Source

Optional

Type: esri.LayerDataSource (3.x)* | esri.LayerMapSource (3.x)* | DynamicDataLayer (4.x)* | DynamicMapLayer (4.x)*

The layer source used with a dynamic layer. If used, the Url input must also be specified and reference a dynamic layer.

For example, http://server/arcgis/rest/services/<serviceName>/MapServer/dynamicLayer.

Requires ArcGIS Server 10.1+.

Spatial Relationship

Optional

Type: "contains" | "crosses" | "intersects" | "envelope-intersects" | "index-intersects" | "overlaps" | "touches" | "within" | String

The spatial relationship to be applied on the input geometry while performing the query.

The default is "intersects".

Dimensionally Extended 9 Intersection Model (DE-9IM) matrix relation strings are also supported.

Start

Optional

Type: Number

Zero-based index indicating where to begin retrieving features.

Should be used in conjunction with query.num.

Use this to implement paging and retrieve "pages" of results when querying.

Features are sorted ascending by object ID by default.

Valid only for feature services hosted on ArcGIS Online.

Text

Optional

Type: String

Shorthand for a literal search text on the display field, equivalent to: Where <displayField> like '%%'.

The text is case sensitive.

This parameter is ignored if the where parameter is specified.

You can determine what the display field is for a layer using the ArcGIS Services Directory.

Time Extent

Optional

Type: any

The time instant or the time extent to query.

Units

Optional

Type: String

Distance unit.

Valid only for feature services hosted on ArcGIS Online.

Known values: feet, miles, nautical-miles, us-nautical-miles, meters, kilometers.

Default value: meters.

* Geocortex Workflow uses different versions of Esri's ArcGIS API for JavaScript depending on the type of application. Web AppBuilder 2D apps and Geocortex HTML5 viewers use version 3.x of the JavaScript API. Web AppBuilder 3D apps use version 4.x.

Outputs

feature

Type: esri.Graphic (3.x, 4.x)*

The first feature of the result feature set.

features

Type: esri.Graphic[] (3.x, 4.x)*

The features of the result feature set.

results

Type: esri.FeatureSet (3.x, 4.x)*

The feature set returned by the query operation.

* Geocortex Workflow uses different versions of Esri's ArcGIS API for JavaScript depending on the type of application. Web AppBuilder 2D apps and Geocortex HTML5 viewers use version 3.x of the JavaScript API. Web AppBuilder 3D apps use version 4.x.

Properties

For information about the ID, Display Name, and Description properties, see Properties Common to all Activities.

Version Information

Supported from: Geocortex Viewer for HTML5 2.9, Web AppBuilder for ArcGIS 2.4.

See Also...

Get a Feature Set by Querying a Map Service

Find a Particular Feature Returned by a Query

Example 2 - Verbose Log for a Query Layer Activity

© 2019 Latitude Geographics Group Ltd. All Rights Reserved.

Documentation Version 5.10