Trouble with buffer query not returning results

Discussion created by jmaxwell1562 on Apr 6, 2011
Latest reply on Apr 11, 2011 by sli-esristaff
Hi:  I am following the example query with buffer example:

I am getting the buffer to draw, but no results are being returned.

I can't figure out what's wrong and would appreciate any help.



Here is my code: 

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <!--The viewport meta tag is used to improve the presentation and behavior of the samples
      on iOS devices-->
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>QueryTask with query geometry from another task</title>
    <link rel="stylesheet" type="text/css" href="">

    <script type="text/javascript" src=""></script>
    <script type="text/javascript">

      var queryTask
   /*Initialize map, buffer, & query params*/
      function init() {
    var startExtent = new esri.geometry.Extent({"xmin":3336800.8350631,"ymin":2636200.25720764,"xmax":6477996.0793392,"ymax":5025218.13686783,"spatialReference":{"wkid":3089}});
    var map = new esri.Map("mapDiv", {extent:startExtent});
    //listen for when map is loaded and then add query functionality
        dojo.connect(map, "onLoad", initFunctionality);

        var streetMap = new esri.layers.ArcGISDynamicMapServiceLayer("");
var gap = new esri.layers.ArcGISDynamicMapServiceLayer("");

      function initFunctionality(map) {
        //identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters.
        //If this null or not available the buffer operation will not work.  Otherwise it will do a http post to the proxy.
    // = "/arcgisserver/apis/javascript/proxy/proxy.ashx";
        // = false;
    // = "/arcgisserver/proxy/proxy.ashx";
       = ""; = false;

        //Geometry Service Endpoint
        var gsvc = new esri.tasks.GeometryService("");
    queryTask = new esri.tasks.QueryTask("");

    // Query
    var query = new esri.tasks.Query();

        // +++++Listen for map onClick event+++++
        dojo.connect(map, "onClick", function(evt) {;
          var params = new esri.tasks.BufferParameters();
          params.geometries  = [ evt.mapPoint ];
          // Buffer in linear units such as meters, km, miles etc.
          params.distances = [ dojo.byId('bufferDistance').value ];
          params.unit = esri.tasks.GeometryService.UNIT_STATUTE_MILE;
          params.bufferSpatialReference = new esri.SpatialReference({"wkid": 3089});
         params.outSpatialReference = new esri.SpatialReference({"wkid": 3089});
          dojo.byId('messages').innerHTML = "<b>Creating Buffer Using Geometry Service...</b>";

        // +++++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);;

       query.returnGeometry = true;
      query.outFields =  ["P_Des_Nm","P_Loc_Nm","Own_Name","Mang_Name"];
     query.outSpatialReference = map.spatialReference;
     query.geometry = geometries[0];
     //query.where = "quadrangle_name='Adairville'"
          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();
 = esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE;
          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++) {
            var graphic = resultFeatures[i];
     var pareas = returnRecordNums(fset);
     var r = "";
     r = "<b>The record numbers within the buffer are <i>" + pareas + "</i>.</b>";
     dojo.byId('messages').innerHTML = r;

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


  <body class="claro">
    Zoom to area and click on map to select protected areas within the buffered circle.<br/>
    Buffer distance (in miles): <input type="text" id="bufferDistance" value="1" size="5"/>

    <div id="mapDiv" style="width: 500px; height:500px;"></div>
    <span id="messages"></span>