AnsweredAssumed Answered

Select with Multipoint

Question asked by timw1984 Champion on Jul 20, 2015
Latest reply on Jul 20, 2015 by timw1984

Hey everybody,

 

tagging on to this discussion, I had another question. Robert Scheitlin, GISP was able to help me out per usual, but I ran into another problem. I want to use a Multipoint Geometry to select all features in a polygon that intersect with a point from the multipoint geometry.

 

Here is the code I have so far:

 

var myButton2 = new Button({
  label: "Analyze",
  onClick: function(){
  //var selectedCity = [];
  //var allPoints = [];
  var mp = new Multipoint();  
  arrayUtils.map(NewLayer.graphics, function(gra){  
  mp.addPoint(gra.geometry);  
  //allPoints.push(gra);
  });  
  console.log(mp);
  var query = new Query();
  //for (var i = 0; i < allPoints.length; i++) {
  //query.geometry = allPoints[i].geometry;
  //thisIsaTest = ft6select.selectFeatures(query,FeatureLayer.SELECTION_ADD, function(evt2){
  //if(evt2.length > 0){
  //var tutu = evt2[0].geometry;
  //selectedCity.push(tutu);
  //console.log(selectedCity);
  //}
  //});
  //}
  console.log(selectedCity);
  query.geometry = mp;
  ft6select.selectFeatures(query);
  }
}, "progButtonNode2").startup();


ft6select.on('selection-complete', function (evt){
  console.log(evt);
});

 

This code returns an empty array, meaning nothing has been selected. When I use the commented out method, using each point of the multipoint geometry, it does select features that intersect with each point.

 

I hope this makes any sense.

 

Tim

Outcomes