AnsweredAssumed Answered

Select features with buffer not working properly

Question asked by rcsellman on Oct 3, 2014
Latest reply on Oct 3, 2014 by rcsellman

I'm trying to incorporate an esri sample in my app, where the user clicks on the map, which creates a buffer and selects features within that buffer.  I can get the the buffer to work correctly and the selected features are drawing ok, however I'm trying to push the selected results to an enhanced datagrid and keep getting this error: "ReferenceError: array is not defined".  I feel like I'm missing something really small but can't figure it out.  Can anyone help??

 

Here's the code I am using:

var gridNF = new EnhancedGrid({
  structure : [
  {name: "UNAME", field : "UNAME"}
  ],
  plugins: {
  exporter: true,
  printer: true
  }
  }, "divGrid");
  gridNF.startup();

  var outFieldsNF = ["UNAME"];

  var doesFeatureLayer = new FeatureLayer("http://summitgis.summitoh.net:6080/arcgis/rest/services/DOES_Mercator/MapServer/1",{
  outFields: ["*"],
  mode: FeatureLayer.MODE_ONDEMAND
  });

  var symbol = new SimpleMarkerSymbol(  
  SimpleMarkerSymbol.STYLE_CIRCLE,  
  12,  
  new SimpleLineSymbol(  
  SimpleLineSymbol.STYLE_NULL,  
  new Color([247, 34, 101, 0.9]),  
  1  
  ),  
  new Color([207, 34, 171, 0.5])  
  );

  doesFeatureLayer.setSelectionSymbol(symbol);  
  
  map.addLayer(doesFeatureLayer);

  var circleSymb = new SimpleFillSymbol(  
  SimpleFillSymbol.STYLE_NULL,  
  new SimpleLineSymbol(  
  SimpleLineSymbol.STYLE_SHORTDASHDOTDOT,  
  new Color([105, 105, 105]),  
  2  
  ), new Color([255, 255, 0, 0.25])  
  );  
  
  var circle;  
  var radius = parseInt(dom.byId("bufferDistance").value); 

  map.on("click", function(evt){  
  var radius = parseInt(dom.byId("bufferDistance").value);  
  circle = new Circle({  
  center: evt.mapPoint,  
  geodesic: true,  
  radius: radius,  
  radiusUnit: "esriFeet"  
  });  ;  
  
  map.graphics.clear();  
  //map.infoWindow.show();  
            
  var graphic = new Graphic(circle, circleSymb);  
  map.graphics.add(graphic);

  var query = new Query();  
  query.geometry = circle.getExtent();  
  doesFeatureLayer.queryFeatures(query, selectInBuffer);  
  });

  function selectInBuffer(response){  
  var feature;  
  var features = response.features;  
  var inBuffer = [];  
  
         
  for (var i = 0; i < features.length; i++) {  
  feature = features[i];  
  if(circle.contains(feature.geometry)){  
  inBuffer.push(feature.attributes[doesFeatureLayer.objectIdField]);  
  }  
  }  
  
  var query = new Query();  
  query.objectIds = inBuffer;  
          
  doesFeatureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(results){                          
            
  });  
   
  populateGrid(response);
  }  

  function populateGrid(results) {


  var gridData;


  dataNF = array.map(results.features, function(feature) {
  return {
          
  "UNAME" : feature.attributes[outFieldsNF[1]],


  }
  });

   
  var memStore = new ItemFileWriteStore({
  data : {
  identifier: 'OBJECTID',
  items: dataNF
  }
  });
   
  gridNF.setStore(memStore);
  }











Outcomes