Overview
This topic discusses the JSON representation of classification definition objects. The classification definition optionally allows specifying symbology that returns a complete renderer object. It also includes an optional colorRamp object that's used to assign a unique color to each symbol.
The following classification definitions are discussed:
- Class Breaks
- Unique Value
Class Breaks
Use the class breaks classification scheme to group values into classes.
{
"type": "classBreaksDef",
"classificationField": "<field name>",
"classificationMethod": "<esriClassifyNaturalBreaks | esriClassifyEqualInterval | esriClassifyQuantile |
esriClassifyStandardDeviation | esriClassifyGeometricalInterval>",
"breakCount": <count>,
"standardDeviationInterval": < 1 | 0.5 | 0.33 | 0.25 >, //use when classificationMethod is esriClassifyStandardDeviation
//optional. use to normalize class breaks
"normalizationType": "<esriNormalizeByField | esriNormalizeByLog | esriNormalizeByPercentOfTotal>",
"normalizationField": "<field name>", //use when normalizationType is esriNormalizeByField
//optional. use to define symbol for classes
"baseSymbol": <symbol>,
"colorRamp": <colorRamp>
}{
"type": "classBreaksDef",
"classificationField": "POP2010",
"classificationMethod": "esriClassifyNaturalBreaks",
"breakCount": 5,
"normalizationType": "esriNormalizeByField",
"normalizationField": "Area"
}Keep in mind the following for the properties above:
- The
typeproperty for class breaks classification isclass.Breaks Def - The
normalizationandType normalizationproperties can be used to normalize class breaks. These properties are optional.Field - The optional properties,
baseandSymbol color, can be used to include a symbol with varying color for each class.Ramp - If
onlybaseis defined, a default color ramp is used to assign a color for each class.Symbol - If only
coloris defined, a default symbol is created based onRamp geometryof the feature class, and theType coloris used to assign color to the symbol for each class.Ramp - If
baseandSymbol colorare missing, the map server assumes default values for these properties and returns the results with an appropriate symbol and color.Ramp
- If
- When
classificationisMethod esri, useClassify Standard Deviation standardto specify the interval size. When done this way,Deviation Interval breakis ignored.Count
Unique value
Use the unique value classification scheme to group values based on a unique combination of one or more (up to three) fields.
{
"type": "uniqueValueDef",
"uniqueValueFields": ["<field name 1 >","<field name 2>","<field name 3>"],
"fieldDelimiter": "field_delimiter_character",
//optional. use to define symbol for unique values
"baseSymbol": <symbol>,
"colorRamp": <colorRamp>
}{
"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"
}
}Keep in mind the following for the properties above:
- The
typeproperty for unique value classification isunique.Value Def - The optional properties,
baseandSymbol color, can be used to include a symbol with varying color for each class.Ramp - If only
baseis defined, a default color ramp is used to assign a color for each class.Symbol - If only
coloris defined, a default symbol is created based on geometryType of the feature class, and theRamp coloris used to assign color to the symbol for each class.Ramp - If
baseandSymbol colorare missing, the map server assumes default values for these properties and returns the results with an appropriate symbol and color.Ramp
- If only