AnsweredAssumed Answered

How to change feature layer style using its parameters

Question asked by ssabbiu on Nov 19, 2016
Latest reply on Nov 22, 2016 by ssabbiu

This is the code that I have written till now.

require([
   "esri/Map",
   "esri/views/MapView",
   "esri/layers/MapImageLayer",
   "esri/renderers/SimpleRenderer",
   "esri/symbols/SimpleFillSymbol",
   "dojo/domReady!"
],
function(
   Map, MapView, MapImageLayer, SimpleRenderer, SimpleFillSymbol
) {

   var permitsLyr = new MapImageLayer({
   url: "http://apps.geoportal.icimod.org/ArcGIS/rest/services/Nepal/District/MapServer",
   sublayers: [
   {
      id: 1,
      visible: true,
   },
   {
      id: 0,
      visible: true,
   }
   ],

});

/*****************************************************************
* Add the layer to a map
*****************************************************************/
var map = new Map({
   // basemap: "dark-gray",
   layers: [permitsLyr]
});

var view = new MapView({
   container: "viewDiv",
   map: map
});

/*****************************************************************
* Animate to the layer's full extent when the layer loads.
*****************************************************************/
permitsLyr.then(function() {
   view.goTo(permitsLyr.fullExtent);
});
});

 

Now, I would like to change default renderer given in the District - Nepal/District  as 

Drawing Info:

      Renderer:
        Simple Renderer:
        Symbol:

                        Simple Fill Symbol:

          Style: esriSFSSolid, Color: [Undefined]
          Outline:

                                    Simple Line Symbol:

            Style: esriSLSSolid, Color: [78, 78, 78, 255], Width: 1
        Label:
        Description:
        Transparency: 0
        Labeling Info: N/A

     

    How do I change the default color and style for it? Also, using its attribute "DIST_CODE", I also want to apply different color for different polygons.

     

    I am new to this field. So, help me out.

    Outcomes