Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/workers
Class: StandardGeographyQueryTask

require(["esri/tasks/geoenrichment/StandardGeographyQueryTask"], function(StandardGeographyQueryTask) { /* code goes here */ });

Description

(Added at v3.12)
(Currently in beta)
Geoenrichment helper task that returns standard geography IDs and features for the supported geographic levels in Canada, the United States and a number of European countries. For example, you can use this service to find the FIPS for the county of San Diego, which is 06073. You can then use this FIPS ID within the Geoenrichment service study area definition to get geometry and optional demographic data for the county.

Samples

Search for samples that use this class.

Constructors

NameSummary
new StandardGeographyQueryTask(url?)Creates a new instance of the StandardGeographyQueryTask class.

Methods

NameReturn typeSummary
execute(GeographyQuery)PromiseExecutes the StandardGeographyQueryTask.

Events

[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.

Events

NameEvent ObjectSummary
error
{
  error: <Error>
}
Fires when an error occurs during the query.
execute-complete
{
  features: <FeatureSet>
}
Fires when the query successfully executes.
Constructor Details

new StandardGeographyQueryTask(url?)

Creates a new instance of the StandardGeographyQueryTask class.
Parameters:
<String> url Optional URL to the Geoenrichment server. Defaults to the World Geoenrichment Server (http://geoenrich.arcgis.com/arcgis/rest/services/World/GeoenrichmentServer) if a valid URL is not provided.
Sample:
require([
  "esri/tasks/geoenrichment/GeographyQuery",
  "esri/tasks/geoenrichment/StandardGeographyQueryTask",
  ...
], function(
  GeographyQuery,
  StandardGeographyQueryTask,
  ...
) {
  var standardGeographyQueryTask = new StandardGeographyQueryTask();

  var query = new GeographyQuery({
    countryID: "US",
    datasetID: "USA_ESRI_2013",
    generalizationLevel: "6",
    geographyLayerIDs: ["US.Places"],
    returnGeometry: "true",
    where: "San"
  });

  return standardGeographyQueryTask.execute(query).then(function(result) {
    // do something with result.featureSet
  });
}); 
Method Details

execute(GeographyQuery)

Executes the StandardGeographyQueryTask. Fires the onExecuteComplete event when completed successfully, and the onError event if an error occurs.
Return type: Promise
Parameters:
<GeographyQueryBase> GeographyQuery Required See GeographyQuery or SubGeographyQuery classes for more details about available properties.
Event Details
[ On Style Events | Connect Style Event ]

error

Fires when an error occurs during the query.
Event Object Properties:
<Error> error Fires when an error occurs during the query.

execute-complete

Fires when the query successfully executes.
Event Object Properties:
<FeatureSet> features The FeatureSet returned from the query.