Generate Renderer (Map Service\Layer)

Description

generateRenderer operation is performed on a 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 performned 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.

Note:

When generating a class breaks renderer map server uses maxSampleSize configuration property set on the map service to determine the number of records to sample. In rare cases these classes might not include the minimum or maximum value in the data.

Request Parameters

Parameter

Details

f

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

Values: html | json

classificationDef

Description: The definition using which the parameter is generated.

Note:

Use either one of ClassBreaks or UniqueValue classification definition.

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

Example:

where = POP2000 > 350000

gdbVersion

Description: GeoDatabase version to query. This parameter applies only if hasVersionedData property of the service and isDataVersioned property of the layer(s) queried are true. If this is not specified, query will apply to published map's version.

Syntax: gdbVersion=<geodatabase version>

Example: gdbVersion=sde.USER1

Example Usage

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

JSON Response Syntax (when classificationDef type is uniqueValueDef)

{"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)

{"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]}}]}