I have looked through the documentation, browsed the widgets and searched here on GIS SE. I can't find any information regarding being able to override the default (published) symbology of a ArcGIS Server feature service.

Is this a feature that is available and I am overlooking it?

For now I am going to republish my service with new symbols, but like the idea of being able to alter it in the application to create different presentations of the same map.

1 Answer 1


I tried to adjust for yourself.

You need to edit the file Controller.js. In section initLayer you must add the following at the end:

    if (layer.options.renderer_url != undefined && layer.options.renderer_url != '') {
        require([layer.options.renderer_url], function () { l.setRenderer(renderer); })

In Viewer.js you must to each operationallayer add to section options parameter renderer_url that contains the path to file where you define renderer.

    operationalLayers: [{
        type: 'feature',
        url: 'http://.../MapServer/0',
        title: 'Name',
        options: {
            id: 'yourID',
            renderer_url: 'renderers/myRenderer.js',
            opacity: 1.0,
            visible: false,
            outFields: ['*'],
            mode: 0,
            refreshInterval: 0.08333 //if you want refresh layer

Finally you create for each layer different file with renderer (for example myRenderer.js in folder renderers in root of CMV app):

    var renderer = new esri.renderer.UniqueValueRenderer(new esri.symbol.PictureMarkerSymbol('images/image.png', 30, 30), attributeField as String);

    //add symbol for each possible value
            value: "value1",
            symbol: new esri.symbol.PictureMarkerSymbol('images/image1.png', 30, 30),
            label: "label1"
            value: "value2",
            symbol: new esri.symbol.PictureMarkerSymbol('images/image2.png', 30, 30),
            label: "label2"

For me it works.

  • Thank you for your help. I am trying to test out your solution in my map but I think I need just a little more information to get it working. I am looking at my Controller.js and am unsure where I should exactly paste the "if (layer.options.renderer_url..." code. My initLayer section has some pre-existing code, a function that takes a, b as parameters. I have tried pasting your code into that function in various places but all I am doing is crashing the application. Is it possible for you to paste your entire working initLayer section for me to take a look at?
    – gisloc
    Commented Apr 28, 2015 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.