Dear Community,
For a school project I need to make use of the Arcgis REST API. At this moment I am struggling with the generate renderer operation. From the documentation I know that you have to pass a classification definition that can look like this:
{
"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": "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>
}
//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"
}
}
However I am not sure what the <fieldName> value should be. Everytime I try to pass in a value I get an error saying it could not find one or more unique value fields.
for reference see:
Generate Renderer documentation page
Classification definition documentation page
Thanks in advance!
Solved! Go to Solution.
The unique value filed should be one of these:
I got it to work putting one of the fields above.
The unique value filed should be one of these:
I got it to work putting one of the fields above.