FRAMES | NO FRAMES Description | Parameters | Examples | Response
Generate Renderer (Operation)
URL http://<dynamic-layer-url>/Renderer
Parent Resource Dynamic Layer / Table
Required Capability Map

Description

This operation is supported from 10.1 onwards.

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.

Parameters

Parameter Details
f Description: The response format. The default response format is html.

Values: html | json
layer Description: Dynamic layer / table source definition.

Note:
  • Use "gdbVersion" on dynamic map layer definition to specify an alternate geodatabase version.
Syntax:
  {
    "id": <layerOrTableId>,
    "source": <layer source>,
    "definitionExpression": "<definitionExpression>"
  }
Example:
{
  "id": 101,
  "source":
  {
    "type": "mapLayer",
    "mapLayerId": 0,
    "gdbVersion": "SDE.DynamicLayers"
  }
}
classificationDef Description: The definition using which the renderer is generated.

Note: Use either one of ClassBreaks or UniqueValue classification definition.

Syntax:
classificationDef = classification definition
Example:
//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 map server would assign an appropriate baseSymbol:

http://servicesbeta2.esri.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:

http://servicesbeta2.esri.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)

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

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)

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