Buffer query result polygon

Discussion created by doncav on Aug 1, 2012
Latest reply on Aug 20, 2012 by doncav
I am trying to buffer the result of a query which is a polygon.  I have tried several different approaches but my code always fails when calling the geometry service's buffer function.  Once I buffer the selected polygon (the query result) I'm going to use the geometry of the buffer to do a spatial query.  Can anyone see what is the issue with my code?  Thanks, Don.

function performParcelSearch(){
    var parcelVal = $("#inputParcel").val();
    var bufferDist = $("#inputBuffer").val();
    var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.25]));
    var queryTask = new esri.tasks.QueryTask(searchLayer);
    if (!parcelVal) {
        alert("Please enter a parcel number.");
    else {
        var qryExp = "parcel_f = '" + parcelVal + "'";
        //initialize query
        var parcelQuery = new esri.tasks.Query();
        parcelQuery.returnGeometry = true;
        parcelQuery.outFields = ["*"];
        parcelQuery.where = qryExp;
        //execute query
        queryTask.execute(parcelQuery, function showResults(featureSet){
            //remove all graphics on the maps graphics layer
            var features = featureSet.features;
            //QueryTask returns a featureSet.  Loop through features in the featureSet and add them to the map.
            dojo.forEach(features, function(feature){
                var graphic = feature;
                //Add graphic to the map graphics layer.
                var featureextent = graphic.geometry.getExtent();
                map.setExtent(featureextent, true);
                // Performs Buffer Search
                if (bufferDist > 0) {
                    var params = new esri.tasks.BufferParameters();
                    params.distances = bufferDist;
                    params.bufferSpatialReference = map.spatialReference;
                    params.outSpatialReference = map.spatialReference;
                    params.unit = esri.tasks.GeometryService.UNIT_FOOT;
                    params.geometries = feature.geometry;
     geometryService.buffer(params, showBuffer);