Get values used to define a renderer

379
2
08-26-2011 07:46 AM
MarkSmith
New Contributor III
Hello,

Can anyone please show me some code that allows me to get the values of a layer's renderer?

What I mean is this: If I define a classification in my service where a shape is symbolised differently based on a value (e.g. 'A' = blue, 'B' = red 'C' = green), then this automatically comes through in the editing template picker for the user to pick the type of feature they want to draw.  I don't want to use the template picker however, I just want to be able to programmatically get the values which define the symbology for this layer, 'A', 'B' and 'C' so that I can do other things with the values.

I have had a look through the reference material, but to be honest I'm not sure of the best place to start, and if anyone has done this already it could save an awful lot of time, so any help would be great.

Thank you very much,

Mark.
0 Kudos
2 Replies
derekswingley1
Frequent Contributor
You can get this info from the REST API. Each layer has an endpoint you can hit:  http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapSe...

The layer's drawingInfo object contains a renderer that tells you how each value or range of values is symbolized.
0 Kudos
MarkSmith
New Contributor III
Ah yes, of course.  I can work with that, thank you very much.

It would be great if future developments of the API could see some properties of a layer exposed through JavaScript, such as the information I needed here, but also a layer's geometry type.

Thanks again,

Mark.
0 Kudos