dougcurl

Buffer query not returning coordinates in correct spatial reference

Discussion created by dougcurl on Feb 2, 2011
Pulling my hair out over this -maybe can get some help here. I modified the "Query map with buffer polygon" service to use my own service. Have most of it working correctly (I can return features within buffer) except that when the code executes the queryTask - the features are returned in decimal degree and not in the KY State Plane (wkid: 3089) that I specified in the query outSpatialReference (which is also the same for the service I'm querying and the basemap).  What's strange is that if I change the query to a non-spatial query (not using the buffer, but a simple where statement), the features return in the correct spatial reference. Any ideas on what I'm doing wrong here?

My example can be viewed here:
http://kgs.uky.edu/kgsmap/testBuffer.html

My server is 9.3.1 and using the Javascript API 2.1

The offending bits of the code are here - I commented out the where statement that works:
        // +++++Listen for GeometryService onBufferComplete event+++++
        dojo.connect(gsvc, "onBufferComplete", function(geometries) {
          var symbol = new esri.symbol.SimpleFillSymbol("none", new esri.symbol.SimpleLineSymbol("dashdot", new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]));
          var graphic = new esri.Graphic(geometries[0],symbol);
     map.graphics.add(graphic);

       query.returnGeometry = true;
      query.outFields = ["record_number","original_result","surface_elevation", "total_depth"];
     query.outSpatialReference = map.spatialReference;
     query.geometry = geometries[0];
     //query.where = "quadrangle_name='Adairville'"
     queryTask.execute(query);
          dojo.byId('messages').innerHTML = "<b>Executing Query with Result Buffer Geometry...</b>";
        });

        // +++++Listen for QueryTask executecomplete event+++++
        dojo.connect(queryTask, "onComplete", function(fset) {
          //create symbol for selected features
          var symbol = new esri.symbol.SimpleMarkerSymbol();
          symbol.style = esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE;
          symbol.setSize(8);
          symbol.setColor(new dojo.Color([255,255,0,0.5]));

          //var infoTemplate = new esri.InfoTemplate("Block: ${BLOCK}", "${*}");
          var resultFeatures = fset.features;
          for (var i=0, il=resultFeatures.length; i<il; i++) {
      console.log(resultFeatures[i])
            var graphic = resultFeatures[i];
            graphic.setSymbol(symbol);
            map.graphics.add(graphic);
          }
     var recordnums = returnRecordNums(fset);
     var r = "";
     r = "<b>The record numbers within the buffer are <i>" + recordnums + "</i>.</b>";
     dojo.byId('messages').innerHTML = r;
        });

   function returnRecordNums(fset){
    var features = fset.features;
    var record_nums = "";
    for (var x = 0; x < features.length; x++) {
     record_nums = record_nums + ", " + features[x].attributes['record_number'];
    }
    return record_nums;
   }

Outcomes