How to change picture marker symbol based on a feature attribute

4254
1
02-06-2015 06:48 AM
CharlesGant
New Contributor III

Seems simple enough.  Using the code below, how would I use a different symbol based on an attribute of the LatestLSRCSV layer?  I assume I would need to create new "symbol" variables for each possible entry of the attribute that will decide the symbol?

   //Add LSR Event Layers
   var LatestLSRCSVtemplate = new InfoTemplate();
   LatestLSRCSVtemplate.setTitle("Local Storm Report Attributes");
   LatestLSRCSVtemplate.setContent(getLatestLSRCSVTextContent);
   var LatestLSR = new CSVLayer("./NewLSR.csv",{id:"LatestLSR",refreshInterval: 1.0,mode: FeatureLayer.MODE_SELECTION,outFields: ["*"],infoTemplate: LatestLSRCSVtemplate});
   var symbol =  new PictureMarkerSymbol({"angle":0,"xoffset":0,"yoffset":0,"type":"esriPMS","url":"http://static.arcgis.com/images/Symbols/Basic/RedSphere.png","contentType":"image/png","width":22,"height":22});
   var renderer = new SimpleRenderer(symbol);
   LatestLSR.setRenderer(renderer);
   map.addLayer(LatestLSR);
   LatestLSR.hide();
0 Kudos
1 Reply
JakeSkinner
Esri Esteemed Contributor

Hi Charles,

Take a look at using the UniqueValueRenderer.  An example can be found here.

0 Kudos