AnsweredAssumed Answered

Select features and zoom to layers

Question asked by sibghatullah86 on Apr 15, 2017
Latest reply on Apr 17, 2017 by sibghatullah86

I am trying to select highlight features and zoom to selected features layer extent.My code below runs but doesn't highlight any feature.

 

 

 

on(dom.byId("try"), "click", function () {
var queryTask = new QueryTask("http://localhost:6080/arcgis/rest/services/RAEC/MapServer/12");

//build query filter
var que = new Query();
que.returnGeometry = true;
que.outFields = ["FeederID", "OBJECTID"];
que.outSpatialReference = { "wkid": 32640 };
que.where = "FeederID<> ''";
symbol = new SimpleMarkerSymbol();
symbol.setStyle(SimpleMarkerSymbol.STYLE_SQUARE);
symbol.setSize(10);
symbol.setColor(new Color([255,255,0,0.5]));


queryTask.execute(que,showResults);
function showResults(featureSet) {

map.graphics.clear();

var resultFeatures = featureSet.features;

for (var i=0, il=resultFeatures.length; i<il; i++) {
var graphic = resultFeatures[i];
graphic.setSymbol(symbol);
map.graphics.add(graphic);
}
}
});

Outcomes