benlam

Mutiple Picture Symbo Sets

Discussion created by benlam on Dec 13, 2012
The following snippet works on drawing symbols based on a query of the database column "SITE_TYPE" with four different PictureMarkerSymbols.

After doing the first query, however, I did another "onclick" query based on another column with another set of PictureMarkerSymbols.

The features returned correctly but the symbols used were still that of the first.

I had used functions to define different sets of symbols for different columns on queries, but it failed.  It still got stuck with the first set of the symbol definition used for subsequent queries.

Any helps will be appreciated.

Ben Lam


featureLayer = new esri.layers.FeatureLayer("http://vdid-gisedn-2:8399/arcgis/rest/services/flow_BRID/MapServer/0", {
  mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
  outFields: ["OBJECTID", "SITE_TYPE", "SITE_PURP", "MON_FEAT", "FUND_SOURC", "STATUS", "FLOWDATA"],
  infoTemplate: infoTemplate
});

  var symbol = new esri.symbol.PictureMarkerSymbol('markers/RT.png', 15, 25);
  var CT = new esri.symbol.PictureMarkerSymbol('markers/CT.png', 18, 30);  
  var HP = new esri.symbol.PictureMarkerSymbol('markers/HP.png', 18, 30);
  var IC = new esri.symbol.PictureMarkerSymbol('markers/IC.png', 18, 30);
  var IP = new esri.symbol.PictureMarkerSymbol('markers/IP.png', 18, 30);
  
  var renderer = new esri.renderer.UniqueValueRenderer(symbol,"SITE_TYPE");
  renderer.addValue("CT", CT);
  renderer.addValue("HP", HP);
  renderer.addValue("IC", IC);
  renderer.addValue("IP", IP);
  
featureLayer.setRenderer(renderer);
map.addLayers([basemap, featureLayer]);

Outcomes