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

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

Description

(Added at v3.12)
(Currently in beta)
Represents StandardGeographyQuery parameters to search subgeographic areas that are within a parent geography. For example, you could return all the U.S. counties within a given U.S. state or you could return all the Canadian postal areas (FSAs) within a Census Metropolitan Area (city).

Samples

Search for samples that use this class.

Class hierarchy

esri/tasks/geoenrichment/GeographyQueryBase
|_esri/tasks/geoenrichment/SubGeographyQuery

Constructors

NameSummary
new SubGeographyQuery(json?)Creates a new instance of the SubGeographyQuery object.

Properties

NameTypeSummary
countryIDStringTwo-digit country code.
datasetIDStringOptional string that denotes the ID of a dataset associated with a particular country.
featureLimitNumberOptional integer value where you can limit the number of features that are returned from the geographyQuery.
filterGeographyIDsStringParent layer geography IDs.
filterGeographyLayerIDStringParent layer ID.
filterGeographyWhereStringParent layer search string.
generalizationLevelNumberOptional integer that specifies the level of generalization of the geometries.
outSRSpatialReferenceDetermines spatial reference for output geometry if returnGeometry is set to true.
returnCentroidsBooleanUse this parameter to return all the geometries as points.
returnGeometryBooleanDetermines whether response will also include geometries.
subGeographyLayerIDStringLayer ID to return features from.
subGeographyWhereStringQuery string for the subquery.
useFuzzySearchBooleanOptional boolean to enable fuzzy search.

Methods

NameReturn typeSummary
toJson()ObjectConverts object to its JSON representation.
Constructor Details

new SubGeographyQuery(json?)

Creates a new instance of the SubGeographyQuery object.
Parameters:
<Object> json Optional JSON object used to set the properties of the object. JSON field names should match either the property names of the class, or the property names used in the REST API.
Sample:
Query for ZIP codes in the state of New York
require([
  "esri/tasks/geoenrichment/SubGeographyQuery", ...
], function(SubGeographyQuery, ...) {
  var query = new SubGeographySubQuery({
    countryID: "US",
    datasetID: "USA_ESRI_2013",
    filterGeographyLayerID: "US.States",
    filterGeographyWhere: "New York",
    generalizationLevel: "6",
    returnGeometry: "true"
  });
  ...
});
Query for all towns in France containing the word "Paris" in their fields
require([
  "esri/tasks/geoenrichment/SubGeographyQuery", ...
], function(SubGeographyQuery, ...) {
  var query = new SubGeographyQuery({
    countryID: "FR",
    datasetID: "FRANCE",
    generalizationLevel: "6",
    filterGeographyLayerID: ["FR.Commune"],
    filterGeographyWhere: "Paris",
    returnGeometry: "true"
  });
  ...
});
Property Details

<String> countryID

Two-digit country code. For example: "US".

<String> datasetID

Optional string that denotes the ID of a dataset associated with a particular country.
Sample:
query.datasetID = 'US.Census2010';

<Number> featureLimit

Optional integer value where you can limit the number of features that are returned from the geographyQuery. If null, the server will default to 1000.

<String> filterGeographyIDs

Parent layer geography IDs.

<String> filterGeographyLayerID

Parent layer ID.

<String> filterGeographyWhere

Parent layer search string. Syntax is similar to GeographyQuery.where property.

<Number> generalizationLevel

Optional integer that specifies the level of generalization of the geometries. A value of 0 returns the most detailed and 6 is most generalized. Some geography layers, like 'countries', do not support returning highly detailed geometries.
Known values: 0|1|2|3|4|5|6
Default value: 0
Determines spatial reference for output geometry if returnGeometry is set to true.

<Boolean> returnCentroids

Use this parameter to return all the geometries as points. For example, you could return all U.S. ZIP Codes as centroids. Only applies if the returnGeometry property is also set to true.
Known values: true | false
Default value: false

<Boolean> returnGeometry

Determines whether response will also include geometries.
Known values: true | false
Default value: false

<String> subGeographyLayerID

Layer ID to return features from.

<String> subGeographyWhere

Query string for the subquery. Syntax is similar to GeographyQuery.where property.

<Boolean> useFuzzySearch

Optional boolean to enable fuzzy search. See the REST API for details about using fuzzy logic.
Known values: true | false
Default value: false
Method Details

toJson()

Converts object to its JSON representation. Field names in the JSON will match field names used by the REST API.
Return type: Object