How to build a data enrichment app

1. Define a study area

The first step is to define one or more study areas. A study area is a location used to restrict the search for the GeoEnrichment service. The studyAreas parameter is required for a global search or local search. When you submit a request, the service returns information for the study areas provided.

Types of study areas

The value of the studyAreas parameter can take many forms. It can include one or more point, line, or polygon geometries, administrative boundaries, street addresses, and drive time service areas. For points and addresses, the GeoEnrichment service calculates a buffer or service area in which to aggregate data. See the examples below:

Study areaDescriptionExample
Named administrative boundariesIncludes countries, states, U.S. ZIP Codes, etcstudyAreas=[{"sourceCountry":"US","layer":"US.States","ids":["06"]}]
Street addressesDefaults to a one mile buffer around addressstudyAreas=[{"address":{"text":"380 New York St. Redlands, CA 92373"}}]
Buffer around a point or lineDefaults to a one mile buffer around point or linestudyAreas=[{"geometry":{"x":-117.1956,"y":34.0572}}]
Area within a polygonArea within a geometry defined by three or more points.studyAreas=[{"geometry":{"rings":[[[-117.185412,34.063170],[-122.81,37.81],[-117.200570,34.057196],[-117.185412,34.063170]]],"spatialReference":{"wkid":4326}}}]
Drive time service areasCalculates a drive time area around a point or addressstudyAreas=[{"geometry":{"x": -122.435, "y": 37.785},"areaType": "NetworkServiceArea","bufferUnits": "Hours","bufferRadii": [1],"travel_mode":"Driving"}]

2. Specify the data to find

The next step is to define the data you want to retrieve for the study area. To do so, you need to find the names of the analysis variables and/or data collections that are supported by the GeoEnrichment service. There are thousands of data variables and collections to choose from. You can query the service for these values or you can find them interactively with the Analysis Variable Finder and Data Collection Finder.

The general steps are:

  1. Go to the Analysis Variable Finder or Data Collection Finder.
  2. Explore the groups of variables and collections.
  3. Select the variables and data collections and copy the JSON.

Analysis variables

An analysis variable is a parameter that represents data stored within the GeoEnrichment service. All valid enrich queries to the GeoEnrichment service return analysis variables in their response.

You can set the analysisVariables parameter of an enrich request to return global and local data for a study area.

Data collections

A data collection is a predefined list of analysis variables that can be used to get data from the GeoEnrichment service. When you make an enrich request with a data collection, the response contains information for each analysis variable in the collection.

For example, the KeyGlobalFacts data collection contains the following analysis variables:

  • Total Population (TOTPOP)
  • Total Households (TOTHH)
  • Average Household Size (AVGHHSZ)
  • Male Population (TOTMALES)
  • Female Population (TOTFEMALES)

3. Make a request

The final step is to make a request to the GeoEnrichment service. You can use the JavaScript Maps SDK, scripting API, or open source library.

The general steps are:

  1. Reference the service or import the relevent packages access the GeoEnrichment service.
  2. Define the following parameters:
    • studyAreas: The study area in which you want the data returned.
    • The analysisVariables or dataCollections. If you provide neither parameter, data from the KeyGlobalFacts data collection will be returned by default.
    • token: An access token.
  3. Make the request.
Use dark colors for code blocksCopy
1
https://geoenrich.arcgis.com/arcgis/rest/services/World/geoenrichmentserver/Geoenrichment/enrich?<parameters>

APIs

ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS API for PythonArcGIS REST JSEsri LeafletMapLibre GL JSOpenLayersCesiumJS
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
        function getDemographicData(point) {
          // Request demographic data
          arcgisRest.queryDemographicData({
              studyAreas: [{ "geometry": { "x": point.longitude, "y": point.latitude } }],
              authentication: authentication
            })
            .then((response) => {
              if (response.results[0].value.FeatureSet.length > 0 &&
                response.results[0].value.FeatureSet[0].features.length > 0) {
                const attributes = response.results[0].value.FeatureSet[0].features[0].attributes;
                showData(attributes, point);
              } else {
                console.log("No data found.");
              }
            });
        }

REST API

cURLcURLHTTP
Use dark colors for code blocksCopy
1
2
3
4
curl https://geoenrich.arcgis.com/arcgis/rest/services/World/geoenrichmentserver/Geoenrichment/enrich? \
-d "studyAreas=[{'geometry':{'x': -117.1956, 'y': 34.0572}}]"
-d "f=json"
-d "token=<ACCESS_TOKEN>"

Additional resources

Tutorials

Query demographic data

Query demographic information for locations around the world with the GeoEnrichment service.


Get local data

Query local analysis variables in select countries around the world with the GeoEnrichment service.


Find data using analysis variables

Learn how to use the Analysis Variable Finder to get enrichment data.


Find data using data collections

Learn how to use the Data Collection Finder to get enrichment data.


Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.