Skip to main content
deleted 37 characters in body; edited tags
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I have a feature layer that contains 12 items with the same defined style. But I want to change each item to have a unique symbol when rendered.

var Layer = new FeatureLayer("http://...my map server.../0");

Layer.graphics.forEach(function (entry) {
    // loop through each item
    console.log(entry);                        
    console.log(entry.attributes.FID);

    var symbol = new PictureMarkerSymbol({ "url":"/images/icons/fid_" + entry.attributes.FID + ".png", "height":20, "width":20 });  
    entry.setSymbol(symbol);
    var renderer = new esri.renderer.SimpleRenderer(symbol);  
    Layer.setRenderer(renderer); // <-- this appears to override all previous items
});

map.addLayer(Layer);

I omitted some code to keep this simple; what I have now sets a symbol, but it's the symbol of the last entry that is looped for all items.

I need each entry to have a unique symbol defined by its FID (0-11)

I've search through ArcGIS's JavaScript API docs and can't find anything that addresses this. Any help will be appreciated. Thanks.

I have a feature layer that contains 12 items with the same defined style. But I want to change each item to have a unique symbol when rendered.

var Layer = new FeatureLayer("http://...my map server.../0");

Layer.graphics.forEach(function (entry) {
    // loop through each item
    console.log(entry);                        
    console.log(entry.attributes.FID);

    var symbol = new PictureMarkerSymbol({ "url":"/images/icons/fid_" + entry.attributes.FID + ".png", "height":20, "width":20 });  
    entry.setSymbol(symbol);
    var renderer = new esri.renderer.SimpleRenderer(symbol);  
    Layer.setRenderer(renderer); // <-- this appears to override all previous items
});

map.addLayer(Layer);

I omitted some code to keep this simple; what I have now sets a symbol, but it's the symbol of the last entry that is looped for all items.

I need each entry to have a unique symbol defined by its FID (0-11)

I've search through ArcGIS's JavaScript API docs and can't find anything that addresses this. Any help will be appreciated. Thanks.

I have a feature layer that contains 12 items with the same defined style. But I want to change each item to have a unique symbol when rendered.

var Layer = new FeatureLayer("http://...my map server.../0");

Layer.graphics.forEach(function (entry) {
    // loop through each item
    console.log(entry);                        
    console.log(entry.attributes.FID);

    var symbol = new PictureMarkerSymbol({ "url":"/images/icons/fid_" + entry.attributes.FID + ".png", "height":20, "width":20 });  
    entry.setSymbol(symbol);
    var renderer = new esri.renderer.SimpleRenderer(symbol);  
    Layer.setRenderer(renderer); // <-- this appears to override all previous items
});

map.addLayer(Layer);

I omitted some code to keep this simple; what I have now sets a symbol, but it's the symbol of the last entry that is looped for all items.

I need each entry to have a unique symbol defined by its FID (0-11)

I've search through ArcGIS's JavaScript API docs and can't find anything that addresses this.

Source Link
Larry
  • 33
  • 5

Arcgis javascript - Set different symbol for each graphic in feature layer

I have a feature layer that contains 12 items with the same defined style. But I want to change each item to have a unique symbol when rendered.

var Layer = new FeatureLayer("http://...my map server.../0");

Layer.graphics.forEach(function (entry) {
    // loop through each item
    console.log(entry);                        
    console.log(entry.attributes.FID);

    var symbol = new PictureMarkerSymbol({ "url":"/images/icons/fid_" + entry.attributes.FID + ".png", "height":20, "width":20 });  
    entry.setSymbol(symbol);
    var renderer = new esri.renderer.SimpleRenderer(symbol);  
    Layer.setRenderer(renderer); // <-- this appears to override all previous items
});

map.addLayer(Layer);

I omitted some code to keep this simple; what I have now sets a symbol, but it's the symbol of the last entry that is looped for all items.

I need each entry to have a unique symbol defined by its FID (0-11)

I've search through ArcGIS's JavaScript API docs and can't find anything that addresses this. Any help will be appreciated. Thanks.