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
type
property for class breaks classification isclass
.Breaks Def - The
normalization
andType normalization
properties can be used to normalize class breaks. These properties are optional.Field - The optional properties,
base
andSymbol color
, can be used to include a symbol with varying color for each class.Ramp - If
onlybase
is defined, a default color ramp is used to assign a color for each class.Symbol - If only
color
is defined, a default symbol is created based onRamp geometry
of the feature class, and theType color
is used to assign color to the symbol for each class.Ramp - If
base
andSymbol color
are missing, the map server assumes default values for these properties and returns the results with an appropriate symbol and color.Ramp
- If
- When
classification
isMethod esri
, useClassify Standard Deviation standard
to specify the interval size. When done this way,Deviation Interval break
is 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
type
property for unique value classification isunique
.Value Def - The optional properties,
base
andSymbol color
, can be used to include a symbol with varying color for each class.Ramp - If only
base
is defined, a default color ramp is used to assign a color for each class.Symbol - If only
color
is defined, a default symbol is created based on geometryType of the feature class, and theRamp color
is used to assign color to the symbol for each class.Ramp - If
base
andSymbol color
are missing, the map server assumes default values for these properties and returns the results with an appropriate symbol and color.Ramp
- If only