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

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

Description

(Added at v3.12)
(Currently in beta)
The StandardGeographyQueryLocationProvider class uses the Geoenrichment service to generate geometries by querying the standard geography layers.

Samples

Search for samples that use this class.

Class hierarchy

esri/tasks/locationproviders/LocationProviderBase
|_esri/tasks/locationproviders/LocationProviderRemoteBase
  |_esri/tasks/locationproviders/StandardGeographyQueryLocationProvider

Constructors

NameSummary
new StandardGeographyQueryLocationProvider(options)Creates a new instance of the StandardGeographyQueryLocationProvider object.

Properties

NameTypeSummary
geographyQueryTemplateStringA template to be used to build the query for Standard Geography query.
geometryTypeStringThe geometry type of the returned features.
loadedBooleanReturns true when the load event has been fired.
queryParametersObjectAn object that specifies the parameters to use in the Standard Geography query.
standardGeographyQueryTaskStandardGeographyQueryTaskAn instance of the StandardGeographyQueryTask class.

Methods

NameReturn typeSummary
locate(features, options?)DeferredAssigns geometries to the array of Graphic objects.

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 locate.
loadFires after the provider has loaded.
locate-complete
{
  failed: <Graphic[]>,
  features: <Graphic[]>
}
Fires when the locate has completed.
locate-progress
{
  features: <Graphic[]>
}
Fires when the locate() method is in progress.
Constructor Details

new StandardGeographyQueryLocationProvider(options)

Creates a new instance of the StandardGeographyQueryLocationProvider object.
Parameters:
<Object> options Required Define the properties to use when creating the class. See options descriptions for further information.
options properties:
<String> geographyQueryTemplate Required A template to be used to build the query for Standard Geography query.
<Object> queryParameters Optional An object that specifies the parameters to use in the Standard Geography query. Any of the properties in the GeographyQuery properties table can be used in this object.
<StandardGeographyQueryTask> standardGeographyQueryTask Required An instance of the StandardGeographyQuery class.
Sample:
require([
  "esri/tasks/locationproviders/StandardGeographyQueryLocationProvider",
  "esri/tasks/geoenrichment/StandardGeographyQuery",...
], function(StandardGeographyQueryLocationProvider, StandardGeographyQueryTask,...) {
   var locationProvider: new StandardGeographyQueryLocationProvider({
       geographyQueryTemplate: 'NAME:${STATE}',
       queryParameters: {
         countryID: 'US',
         geographyLayerIDs: ['US.States']
       },  
       standardGeographyQueryTask: new StandardGeographyQueryTask()
   });
   ...
   locationProvider.locate(graphicsArray,...).then(function(results) {
     ...
   });
});
Property Details

<String> geographyQueryTemplate

A template to be used to build the query for Standard Geography query.
Sample:
// 1. Query template for State Name:
var locationProvider: new StandardGeographyQueryLocationProvider(
  {
    geographyQueryTemplate: "MajorSubdivisionName:${STATENAMEFIELD}",
    queryParameters:{ sourceCountry: 'US', geographyLayers: 'US.States' },
    standardGeographyQueryTask: new StandardGeographyQueryTask()
  }
);

// 2. Query template for Countries by Name:
var locationProvider: new StandardGeographyQueryLocationProvider(
  {
    geographyQueryTemplate: "NAME:${COUNTRYFIELD}",
    queryParameters:{ geographyLayers: 'countries' },
    standardGeographyQueryTask: new StandardGeographyQueryTask()
 }
);

// 3. Query template for US Zipcode
var locationProvider: new StandardGeographyQueryLocationProvider(
  {
    geographyQueryTemplate: 'ID:${f1}',
    queryParameters: { geographyLayers: 'US.ZIP5', sourceCountry: 'US' },
    standardGeographyQueryTask: new StandardGeographyQueryTask()
  }
);

<String> geometryType

The geometry type of the returned features.
Known values: "esriGeometryPoint" | "esriGeometryPolygon" | "esriGeometryPolyline"

<Boolean> loaded

Returns true when the load event has been fired.
Known values: true | false

<Object> queryParameters

An object that specifies the parameters to use in the Standard Geography query. Any of the properties in the GeographyQuery properties table can be used in this object.

<StandardGeographyQueryTask> standardGeographyQueryTask

An instance of the StandardGeographyQueryTask class.
Method Details

locate(features, options?)

Assigns geometries to the array of Graphic objects.
Return type: Deferred
Parameters:
<Graphic[]> features Required An array of Graphic objects.
<Object> options Optional Optional parameters. See the Object Specifications table below for the structure of the options object.
Object Specifications:
<options>
<SpatialReference> outSpatialReference Required Spatial reference of the output geometry. Defaults to 4326 when not provided.
<Boolean> useExistingGeometries Required A property to notify whether geometry should be located for Graphic object that already has a geometry. The default value is false.
Event Details
[ On Style Events | Connect Style Event ]

error

Fires when an error occurs during locate.
Event Object Properties:
<Error> error Error message returned in a JavaScript error object.

load

Fires after the provider has loaded. The locate method can be called after this event.

locate-complete

Fires when the locate has completed.
Event Object Properties:
<Graphic[]> failed An array of the features that failed to complete successfully.
<Graphic[]> features An array of the completed features.

locate-progress

Fires when the locate() method is in progress.
Event Object Properties:
<Graphic[]> features A status message.
Show Modal