AnsweredAssumed Answered

QueryTask result returns incorrect geometry

Question asked by crackernutter on Apr 16, 2012
Latest reply on Nov 18, 2014 by sadanand_arc
I'm having this really strange problem with some queries and have tried everything. 
First, I construct a query to retrieve the District of Columbia boundary:
      queryTask = new esri.tasks.QueryTask(districtURL);
  var query = new esri.tasks.Query();
                query.returnGeometry = true;
                query.outFields = ["*"];
  query.where = "CITY_NAME = 'Washington'"
                query.outSpatialReference = map.spatialReference;
  queryTask.execute(query);
  dojo.connect(queryTask, "onComplete", queryResults);

The districtURL variable points to a ArcGIS for Server 10 map server layer, which when displayed on a base map is correctly positioned on the District of Columbia. 
HOWEVER, while the queryTask returns one result (as it should - DC boundary), the geometry of that result is located as if it has no associated projection, off the coast of Africa near Nigeria and Cameroon (I zoom to the results in the following code). 
      
     
function queryResults(featureSet){
 console.log(featureSet.features.length);
 map.setExtent(featureSet.features[0].geometry);


I'm tearing my hair out here - the spatial reference of the layers and map service are all 3857.  Why won't the service return the correct geometry?

Thanks, Jay

Outcomes