I have an ArcGIS JavaScript map that I'm trying to use with a Query Task. The query runs fine on the server side and the proper geometry is returned. Then, I draw 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-add
event on the graphics layer it fires and all the event data looks fine (including spatial reference, geometry, etc.) Can anyone think of why this wouldn't work or how else to troubleshoot?
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.
UPDATE: I noticed that graphics layer is referenced to WGS84, while the map and graphic feature are State Plane. I'm just using the built-in map.graphics
layer -- I assumed this would match the spatial reference of the map automatically. Still puzzled.