Generate Renderer (Map Service/Dynamic Layer)

URL:
https://<dynamic-layer-url>/generateRenderer
Methods:
GET
Required Capability:
Map
Version Introduced:
10.1

Description

generateRenderer operation is performed on a dynamic layer / table resource. This operation groups data using the supplied classificationDef (classification definition) and an optional where clause. The result is a renderer object. Use baseSymbol and colorRamp to define the symbols assigned to each class. If the operation is performed on a table, the result is a renderer object containing the data classes and no symbols.

You can provide arguments to the generateRenderer operation as query parameters defined in the parameters table below.

Request Parameters

ParameterDetails

f

Description: The response format. The default response format is html.

Values: html | json

layer

Description: Dynamic layer/table source definition.

Syntax:

Use dark colors for code blocksCopy
1
2
3
4
5
{
    "id": <layerOrTableId>,
    "source": <layer source>,
    "definitionExpression": "<definitionExpression>"
  }

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
{
  "id": 101,
  "source":
  {
    "type": "mapLayer",
    "mapLayerId": 0,
    "gdbVersion": "SDE.DynamicLayers"
  }
}

classificationDef

Description: The definition using the renderer that is generated.

Syntax:

Use dark colors for code blocksCopy
1
classificationDef = classification definition

Example:

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
//classBreaks classification definition
classificationDef = {
  "type": "classBreaksDef",
  "classificationField": "POP2010",
  "classificationMethod": "esriClassifyNaturalBreaks",
  "breakCount": 5,
  "normalizationType": "esriNormalizeByField",
  "normalizationField": "Area"
}

//uniqueValue classification definition with symbology
classificationDef = {
  "type": "uniqueValueDef",
  "uniqueValueFields": ["Type", "AdminClass"],
  "fieldDelimiter": ",",
  "baseSymbol":
  {
    "type": "esriSLS",
    "style": "esriSLSSolid",
    "width": 2
  },
  "colorRamp":
  {
    "type": "algorithmic",
    "fromColor": [115,76,0,255],
    "toColor": [255,25,86,255],
    "algorithm": "esriHSVAlgorithm"
  }
}

where

Description: A where clause for which the data needs to be classified. Any legal SQL where clause operating on the fields in the dynamic layer/table is allowed.

Example: where = POP2000 > 350000

Example Usage

Example 1: Generate Renderer using a unique value classification definition, when baseSymbol is missing, then server would assign an appropriate baseSymbol :

https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/dynamicLayer/generateRenderer?layer={"id":101,"source":{"type":"mapLayer","mapLayerId":3}}&classificationDef={"type":"uniqueValueDef","uniqueValueFields":["sub_region"],"fieldDelimiter": ", ", "colorRamp":{"type":"algorithmic","fromColor":[115,76,0,255],"toColor":[255,25,86,255],"algorithm": "esriHSVAlgorithm"}}&where=&f=pjson

Example 2: Generate Renderer using a class breaks classification definition:

https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/dynamicLayer/generateRenderer?layer={"id":101,"source":{"type":"mapLayer","mapLayerId":3}}&classificationDef={"breakCount":5, "type":"classBreaksDef","normalizationType":"esriNormalizeByPercentOfTotal", "classificationField":"pop2007","classificationMethod":"esriClassifyQuantile","baseSymbol":{"type":"esriSMS","style":"esriSMSSquare","color":[56,125,221,255],"size":10.5,"angle":23,"xOffset":-10,"yOffset":null,"outline":null}}&where=&f=pjson

JSON Response Syntax (when classificationDef type is uniqueValueDef )

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
{
  "type" : "uniqueValue",
  "field1" : "<field1>",
  "field2" : "<field2>",
  "field3" : "<field3>",
  "fieldDelimiter" : "<fieldDelimiter>",
  "defaultSymbol" :  <symbol>,
  "defaultLabel" : "<defaultLabel>",
  "uniqueValueInfos" : [
    {
      "value" : "<value1>",
      "count" : "<number of features with value1>",
      "label" : "<label1>",
      "description" : "<description1>",
      "symbol" :  <symbol1>
    },
    {
      "value" : "<value2>",
      "count" : "<number of features with value2>",
      "label" : "<label2>",
      "description" : "<description2>",
      "symbol" :  <symbol2>
    }
  ]
}

JSON Response Example (when classificationDef type is uniqueValueDef )

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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
{
 "type": "uniqueValue",
 "field1": "sub_region",
 "field2": "",
 "field3": "",
 "fieldDelimiter": ", ",
 "defaultSymbol": {
  "type": "esriSFS",
  "style": "esriSFSSolid",
  "color": [
   110,
   110,
   110,
   255
  ],
  "outline": {
   "type": "esriSLS",
   "style": "esriSLSSolid",
   "color": [
    0,
    0,
    0,
    255
   ],
   "width": 1
  }
 },
 "defaultLabel": "\u003call other values\u003e",
 "uniqueValueInfos": [
  {
   "value": "East North Central",
   "count": 5,
   "label": "East North Central",
   "description": "",
   "symbol": {
    "type": "esriSFS",
    "style": "esriSFSSolid",
    "outline": {
     "type": "esriSLS",
     "style": "esriSLSSolid",
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 1
    },
    "color": [
     115,
     77,
     0,
     255
    ]
   }
  },
  {
   "value": "East South Central",
   "count": 4,
   "label": "East South Central",
   "description": "",
   "symbol": {
    "type": "esriSFS",
    "style": "esriSFSSolid",
    "outline": {
     "type": "esriSLS",
     "style": "esriSLSSolid",
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 1
    },
    "color": [
     92,
     130,
     3,
     255
    ]
   }
  },
  {
   "value": "Middle Atlantic",
   "count": 3,
   "label": "Middle Atlantic",
   "description": "",
   "symbol": {
    "type": "esriSFS",
    "style": "esriSFSSolid",
    "outline": {
     "type": "esriSLS",
     "style": "esriSLSSolid",
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 1
    },
    "color": [
     14,
     148,
     4,
     255
    ]
   }
  },
  {
   "value": "Mountain",
   "count": 8,
   "label": "Mountain",
   "description": "",
   "symbol": {
    "type": "esriSFS",
    "style": "esriSFSSolid",
    "outline": {
     "type": "esriSLS",
     "style": "esriSLSSolid",
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 1
    },
    "color": [
     7,
     166,
     97,
     255
    ]
   }
  },
  {
   "value": "New England",
   "count": 6,
   "label": "New England",
   "description": "",
   "symbol": {
    "type": "esriSFS",
    "style": "esriSFSSolid",
    "outline": {
     "type": "esriSLS",
     "style": "esriSLSSolid",
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 1
    },
    "color": [
     9,
     149,
     184,
     255
    ]
   }
  },
  {
   "value": "Pacific",
   "count": 5,
   "label": "Pacific",
   "description": "",
   "symbol": {
    "type": "esriSFS",
    "style": "esriSFSSolid",
    "outline": {
     "type": "esriSLS",
     "style": "esriSLSSolid",
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 1
    },
    "color": [
     14,
     45,
     201,
     255
    ]
   }
  },
  {
   "value": "South Atlantic",
   "count": 9,
   "label": "South Atlantic",
   "description": "",
   "symbol": {
    "type": "esriSFS",
    "style": "esriSFSSolid",
    "outline": {
     "type": "esriSLS",
     "style": "esriSLSSolid",
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 1
    },
    "color": [
     112,
     18,
     219,
     255
    ]
   }
  },
  {
   "value": "West North Central",
   "count": 7,
   "label": "West North Central",
   "description": "",
   "symbol": {
    "type": "esriSFS",
    "style": "esriSFSSolid",
    "outline": {
     "type": "esriSLS",
     "style": "esriSLSSolid",
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 1
    },
    "color": [
     237,
     21,
     216,
     255
    ]
   }
  },
  {
   "value": "West South Central",
   "count": 4,
   "label": "West South Central",
   "description": "",
   "symbol": {
    "type": "esriSFS",
    "style": "esriSFSSolid",
    "outline": {
     "type": "esriSLS",
     "style": "esriSLSSolid",
     "color": [
      0,
      0,
      0,
      255
     ],
     "width": 1
    },
    "color": [
     255,
     25,
     87,
     255
    ]
   }
  }
 ]
}

JSON Response Syntax (when classificationDef type is classBreaksDef)
{
  "type" : "classBreaks",
  "field" : "<field>",
  "classificationMethod" : "<classification method>",
  "normalizationType" : "<esriNormalizeByField | esriNormalizeByLog | esriNormalizeByPercentOfTotal>",
  "normalizationField" : "<normalization field>", //when normalizationType is esriNormalizeByField
  "normalizationTotal" : <total value>, //when normalizationType is esriNormalizeByPercentOfTotal
  "minValue" : <minValue>,
  "classBreakInfos" : [
    {
      "classMinValue" : <classMinValue1>, //optional
      "classMaxValue" : <classMaxValue1>,
      "label" : "<label1>",
      "description" : "<description1>",
      "symbol" :  <symbol1>
    },
    {
      "classMinValue" : <classMinValue2>,
      "classMaxValue" : <classMaxValue2>,
      "label" : "<label2>",
      "description" : "<description2>",
      "symbol" :  <symbol2>
    }
  ]
}

JSON Response Example (when classificationDef type is classBreaksDef )

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
{
 "type": "classBreaks",
 "field": "pop2007",
 "normalizationType": "esriNormalizeByPercentOfTotal",
 "normalizationTotal": 306348230,
 "minValue": 0.17077754945736098,
 "classBreakInfos": [
  {
   "classMaxValue": 0.44150279569103434,
   "label": "0.170778% - 0.441503%",
   "description": "",
   "symbol": {
    "type": "esriSMS",
    "style": "esriSMSSquare",
    "size": 10.5,
    "angle": 23,
    "xoffset": -10,
    "yoffset": 0,
    "color": [
     0,
     255,
     0,
     255
    ]
   }
  },
  {
   "classMaxValue": 0.96925841549663927,
   "label": "0.441504% - 0.969258%",
   "description": "",
   "symbol": {
    "type": "esriSMS",
    "style": "esriSMSSquare",
    "size": 10.5,
    "angle": 23,
    "xoffset": -10,
    "yoffset": 0,
    "color": [
     0,
     255,
     128,
     255
    ]
   }
  },
  {
   "classMaxValue": 1.7498315560693791,
   "label": "0.969259% - 1.749832%",
   "description": "",
   "symbol": {
    "type": "esriSMS",
    "style": "esriSMSSquare",
    "size": 10.5,
    "angle": 23,
    "xoffset": -10,
    "yoffset": 0,
    "color": [
     0,
     255,
     255,
     255
    ]
   }
  },
  {
   "classMaxValue": 2.9024522191624871,
   "label": "1.749833% - 2.902452%",
   "description": "",
   "symbol": {
    "type": "esriSMS",
    "style": "esriSMSSquare",
    "size": 10.5,
    "angle": 23,
    "xoffset": -10,
    "yoffset": 0,
    "color": [
     0,
     128,
     255,
     255
    ]
   }
  },
  {
   "classMaxValue": 12.235568653358957,
   "label": "2.902453% - 12.235569%",
   "description": "",
   "symbol": {
    "type": "esriSMS",
    "style": "esriSMSSquare",
    "size": 10.5,
    "angle": 23,
    "xoffset": -10,
    "yoffset": 0,
    "color": [
     0,
     0,
     255,
     255
    ]
   }
  }
 ]
}

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