Overview
This is supported at ArcGIS 10.1 and later.
This topic discusses JSON 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 here:
Class breaks
Use the class breaks classification scheme to group values into classes.
Note the following about optional parameters:
- normalizationType and normalizationField—Use these properties to normalize class breaks.
baseSymbol and colorRamp—Use these properties to include a symbol with varying color for each class.
- If onlybaseSymbol is defined, a default color ramp is used to assign a color for each class.
- If only colorRamp is defined, a default symbol is created based on geometryType of the feature class, and the colorRamp is used to assign color to the symbol for each class.
- If baseSymbol and colorRamp are missing, the map server assumes default values for these properties and returns the results with an appropriate symbol and color.
- When classificationMethod is esriClassifyStandardDeviation, use standardDeviationInterval to specify the interval size. breakCount is ignored in this case.
The type property for class breaks classification is classBreaksDef.
JSON syntax
{
"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>
}
JSON example
{
"type": "classBreaksDef",
"classificationField": "POP2010",
"classificationMethod": "esriClassifyNaturalBreaks",
"breakCount": 5,
"normalizationType": "esriNormalizeByField",
"normalizationField": "Area"
}
Unique value
Use the unique value classification scheme to group values based on a unique combination of one or more (up to three) fields.
Note the following about optional parameters:
- baseSymbol and colorRamp—Use these properties to include a symbol with varying color for each class.
- If only baseSymbol is defined, a default color ramp is used to assign a color for each class.
- If only colorRamp is defined, a default symbol is created based on geometryType of the feature class, and the colorRamp is used to assign color to the symbol for each class.
- If baseSymbol and colorRamp are missing, the map server assumes default values for these properties and returns the results with an appropriate symbol and color.
The type property for unique value classification is uniqueValueDef.
JSON syntax
{
"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>
}
JSON example
//uniqueValue classification definition with symbology
{
"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"
}
}