SampleServer6 - Feature Server Generate Renderer operation

710
1
Jump to solution
11-02-2022 05:27 AM
Ahmed_S
New Contributor II

 

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:

sampleserver6 

Generate Renderer documentation page

Classification definition documentation page

Thanks in advance!

0 Kudos
1 Solution

Accepted Solutions
Ahmed_S
New Contributor II

The unique value filed should be one of these:

Ahmed_S_0-1667817851228.png

I got it to work putting one of the fields above.

View solution in original post

0 Kudos
1 Reply
Ahmed_S
New Contributor II

The unique value filed should be one of these:

Ahmed_S_0-1667817851228.png

I got it to work putting one of the fields above.

0 Kudos