- See also:
Method Overview
Name | Return Type | Summary | Object | |
---|---|---|---|---|
Promise<Object> | more details Query information about attachments associated with features from a feature layer specified in the url parameter. | more details | query | |
Promise<Number> | more details Gets a count of the number of features that satisfy the input query. | more details | query | |
Promise<Object> | more details Gets the extent of the features that satisfy the input query. | more details | query | |
Promise<Number[]> | more details Executes a Query against the layer specified in the url parameter. | more details | query | |
Promise<FeatureSet> | more details Executes a Query against the layer specified in the url parameter. | more details | query | |
Promise<FeatureSet> | more details Executes a Query against the layer specified in the url parameter. | more details | query | |
Promise<Object> | more details Executes a RelationshipQuery against the layer or table specified in the url parameter. | more details | query |
Method Details
-
Query information about attachments associated with features from a feature layer specified in the url parameter. It will return an error if the layer's capabilities.data.supportsAttachment is set to false.
Parameters:url StringURL to the ArcGIS Server REST resource that represents a feature layer (usually of a Feature Service Layer or Map Service Layer).
Autocasts from ObjectSpecifies the attachment parameters for query.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<Object> When resolved, returns an object containing AttachmentInfos grouped by the source feature objectIds.
-
Gets a count of the number of features that satisfy the input query.
Parameters:url StringURL to the ArcGIS Server REST resource that represents a feature layer (usually of a Feature Service Layer or Map Service Layer).
Autocasts from ObjectSpecifies the attributes and spatial filter of the query.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<Number> When resolved, the result is the number of features that satisfy the input query. Example:require([ "esri/rest/query", ... ], function(query, ... ) { // url to the layer of interest to query let queryUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"; query.executeForCount(queryUrl, { // autocasts as new Query() where: "POP07_SQMI > 100" }).then(function(count){ console.log(count, " features matched the input query"); }, function(error){ console.log(error); // will print error in console if unsupported layers are used }); });
-
Gets the extent of the features that satisfy the input query. The count of features that satisfy the input query is returned upon resolution as well.
Parameters:url StringURL to the ArcGIS Server REST resource that represents a feature layer (usually of a Feature Service Layer or Map Service Layer).
params QuerySpecifies the attributes and spatial filter of the query.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<Object> When resolved, returns the extent and count of the features that satisfy the input query. See the object specification table below for details. Property Type Description count number The number of features that satisfy the input query. extent Extent The extent of the features that satisfy the query.
-
Executes a Query against the layer specified in the url parameter. The result is an array of the object IDs of features that satisfy the input query.
Parameters:url StringURL to the ArcGIS Server REST resource that represents a feature layer (usually of a Feature Service Layer or Map Service Layer).
Autocasts from ObjectSpecifies the attributes and spatial filter of the query.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<Number[]> When resolved, the result is an array of object IDs for features that satisfy the input query. Example:require([ "esri/rest/query", ... ], function(query, ... ) { // url to the layer of interest to query let queryUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"; query.executeForIds(queryUrl, { // autocasts as new Query() where: "SUB_REGION = 'Pacific'" }).then(function(results){ console.log(results); // an array of object IDs }); ... });
-
executeQueryJSON(url, query, requestOptions){Promise<FeatureSet>}
-
Executes a Query against the layer specified in the url parameter. The result is returned as a FeatureSet, which can be accessed using the
.then()
method. A FeatureSet contains an array of Graphic features, which can be added to the map. This array will not be populated if no results are found.Parameters:url StringURL to the ArcGIS Server REST resource that represents a feature layer (usually of a Feature Service Layer or Map Service Layer).
Autocasts from ObjectSpecifies the attributes and spatial filter of the query.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<FeatureSet> When resolved, a FeatureSet containing an array of graphic features is returned. Example:require([ "esri/rest/query", "esri/rest/support/Query", ... ], function(query, Query, ... ) { // url to the layer of interest to query let queryUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"; // create the Query object let queryObject = new Query(); queryObject.where = "STATE_NAME = 'Washington'"; queryObject.outSpatialReference = { wkid:4269 }; queryObject.returnGeometry = true; queryObject.outFields = [ "HOUSEHOLDS" ]; // call the executeQueryJSON() method query.executeQueryJSON(queryUrl, queryObject).then(function(results){ // results.graphics contains the graphics returned from query }); ... });
-
executeQueryPBF(url, query, requestOptions){Promise<FeatureSet>}
-
Executes a Query against the layer specified in the url parameter. The result is returned as a FeatureSet, which can be accessed using the
.then()
method. A FeatureSet contains an array of Graphic features, which can be added to the map. This array will not be populated if no results are found.Parameters:url StringURL to the ArcGIS Server REST resource that represents a feature layer (usually of a Feature Service Layer or Map Service Layer).
Autocasts from ObjectSpecifies the attributes and spatial filter of the query.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<FeatureSet> When resolved, a FeatureSet containing an array of graphic features is returned. Example:require([ "esri/rest/query", "esri/rest/support/Query", ... ], function(query, Query, ... ) { // url to the layer of interest to query let queryUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"; // create the Query object let queryObject = new Query(); queryObject.where = "STATE_NAME = 'Washington'"; queryObject.outSpatialReference = { wkid:4269 }; queryObject.returnGeometry = true; queryObject.outFields = [ "HOUSEHOLDS" ]; // call the executeQueryPBF() method query.executeQueryPBF(queryUrl, queryObject).then(function(results){ // results.graphics contains the graphics returned from query }); ... });
-
Executes a RelationshipQuery against the layer or table specified in the url parameter. If the query is successful, the returned results are FeatureSets grouped by source layer or table objectIds.
Parameters:url StringURL to the ArcGIS Server REST resource that represents a feature layer (usually of a Feature Service Layer or Map Service Layer).
Autocasts from ObjectSpecifies relationship parameters for querying related features or records from a layer or a table.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<Object> When resolved, the results are FeatureSets grouped by source layer or table objectIds. Each FeatureSet contains an array of Graphic features including the values of the fields requested by the user. Example:require([ "esri/rest/query", "esri/rest/support/RelationshipQuery", ... ], function(query, RelationshipQuery, ... ) { // url to the layer of interest to query let queryUrl = "..."; // specify relationship query parameter const queryRelationship = new RelationshipQuery({ outFields: ["*"], relationshipId: relationshipId, objectIds: [385, 416] }); // query related features that meet the query parameters query.executeRelationshipQuery(queryUrl, queryRelationship).then((results) => { console.log("query results", results); }) .catch((error) => { console.log("query error", error); });