burton449

Use of selectedFeatures in buffer GeometryService

Discussion created by burton449 on Feb 7, 2014
Latest reply on Feb 7, 2014 by burton449
Hi,

I have difficulties with esri.tasks.BufferParameters needed for a esri.tasks.GeometryService. I want to create buffer around selected points but I can't construct the BufferParameters.geometries correctly.

    //select feautures point by drawing on the map
    function initSelectToolbar(map) {
      selectionToolbar = new esri.toolbars.Draw(map);
      var selectQuery = new esri.tasks.Query();
      
      dojo.connect(selectionToolbar, "onDrawEnd", function(geometry) {
        selectionToolbar.deactivate();
        selectQuery.geometry = geometry;
        selectedFeatures = featureLayer.selectFeatures(selectQuery, esri.layers.FeatureLayer.SELECTION_NEW);
      });
    }

    //create buffer arround selected features
    function createBuffer(selectedFeatures) {
       console.log(selectedFeatures)
       var gpBuffer = new esri.tasks.GeometryService("http://localhost:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer");
       var params = new esri.tasks.BufferParameters();

       params.geometries = selectedFeatures._selectedFeatures.geometry; //not working
       params.distance = 10;
       params.unit = esri.tasks.GeometryService.UNIT_KILOMETER;
       params.bufferSpatialReference = new esri.SpatialReference({wkid: 4326});
       params. outSpatialReference = map.spatialReference;
          console.log(params);
       gpBuffer.buffer(params, showBuffer, console.log(error));

    }


Thank you for your help !

Outcomes