rmartin4

Can't draw results of Query Task

Discussion created by rmartin4 on Oct 15, 2013
Latest reply on Jan 18, 2014 by hmCharlotte
Hi all,

I have an JavaScript map I'd like to use a query task on. The query runs fine on the server and returns the expected geometry. Then it draws the feature as follows:

var features = featureSet.features;

for (var i = 0; i < features.length; i++) {
    var feature = features[i];
    feature.setSymbol(lbSymbol);
    feature.setInfoTemplate(lbInfoTemplate);
    map.graphics.add(feature);
}


This was working for a while but it randomly broke and I can't figure out why. No errors -- the map just doesn't draw anything. If I listen for the graphics-draw event on the graphics layer it fires and all the event data looks fine (including spatial reference, geometry, etc.) I've also looked in the graphics array (map.graphics.graphics) and the feature is there. Can anyone think of what would be causing this, or what other diagnostics I can use?

For what it's worth - this code to zoom to the extent of the feature is also broken:

var extent = esri.graphicsExtent(features);
if (extent) {
    extent = extent.expand(3.0);
    map.setExtent(extent);
}


The extent of esri.graphicsExtent(features) matches the extent of the feature. Not sure why the map doesn't zoom on setExtent.

Many thanks,
Robert

Outcomes