I am trying to use someone else's map service in my web map, but their symbology is atrocious so I need to render new colors through JavaScript API.
I try the following (amongst many other efforts spanning 2 days):
parcels = new ArcGISDynamicMapServiceLayer(config.mapServices.parcels, {id:"Parcels"});
parcels.on("load", function(){
var layerDrawingOptions = [];
var layerDrawingOption = new LayerDrawingOptions();
// set symbology overrides
layerDrawingOption.renderer = new SimpleRenderer(symbols.polygon);
// the following index represents the layers in the service to apply the renderer to
layerDrawingOptions[8] = layerDrawingOption;
parcels.setLayerDrawingOptions(layerDrawingOptions);
parcels.setImageFormat("png32");
parcels.setVisibleLayers([8]); //schools,streets,parks,parcels,boundaries,shields
}) ;
map.addLayer(parcels);
I am following this currently: https://developers.arcgis.com/javascript/jsapi/layerdrawingoptions-amd.html#renderer
The few examples at the API deal with renderers for class-breaks, etc, I need to resymbolize all parcels, which should be a similar concept. Any ideas on how I can symbolize a dynamic layer at the client rather than the server using JS API?