AnsweredAssumed Answered

Problems adding attributes to a graphic

Question asked by schlot on Dec 12, 2014
Latest reply on Dec 12, 2014 by kenbuja

I am buffering points and I want to put the attributes of original point on the resultant buffer polygon.  I also want to add an extra attribute for 'source' to indicate which layer I was buffering. 

 

The graphic is getting the feature.attributes from the original point.  I thought I could use graphic.attr('name','value') to add the extra attribute I want.  It doesn't seem to be doing anything.  It's not generating any error either.  Is this not the proper method?

//create a buffer graphic for every point
function generateBufferGraphic(features){
    bufferLayer.clear();  
  var radius = registry.byId("bufferSelect").value;//user can select buffer distance 
  var idPoint,circle;
  arrayUtils.forEach(features, function (feature){
    idPoint = feature.geometry;
     circle = new Circle({  
        center: idPoint,  
        geodesic: true,  
        radius: radius,  
        radiusUnit: "esriMiles"  
     });  
      var graphic = new Graphic(circle, bufferSymbol,feature.attributes);  
      graphic.attr('source','layername');
      bufferLayer.add(graphic);  
  });
}

Outcomes