AnsweredAssumed Answered

Buffer Geometry of a Dropdown Selection

Question asked by ClintonLT16 on Mar 1, 2018
Latest reply on Mar 13, 2018 by ClintonLT16

Hello all,

 

I am trying to buffer a polygon of a dropdown selection. I am hoping somebody can point me where I am going wrong.

var TRSSelect = dom.byId("selectTownshipPanel");

on(TRSSelect, "input", function(e) {
  var type =  e.target.value;

  var task = new QueryTask({
    url: panelurl + "2"
  });

  var params = new Query({
    where: "trs = '" + type + "'",
    returnGeometry: true
  });
  task.execute(params)
  .then(function(response) {
    console.log(response.features["0"].geometry);
    console.log(response.features[0].geometry);
    console.log(response.features[0].geometry + " TRS response FEATURES");
    console.log(response.features["0"].geometry + " TRS response FEATURES");

    buffer = geometryEngine.geodesicBuffer(response.features["0"].geometry, 100, "feet", false);
   
    console.log(typeof buffer);
    console.log("buffer completed");
    bufferLayer.add(new Graphic({
      geometry: buffer,
      symbol: polySym
    }));
   
  });
});

My output for this code is: 

 

It is able to retrieve the geometry, but will not execute the buffer (does not lot to console "buffer completed") and add to the graphic layer.

 

 

I have isolated this to the buffer because if I pass in the response.features[0].geometry, the resulting geometry can be added to my graphic layer illustrated here:

    //buffer = geometryEngine.GeodesicBuffer(response.features["0"].geometry, 100, "feet", false);
   
    console.log(typeof buffer);
    console.log("buffer completed");
    bufferLayer.add(new Graphic({
      geometry: response.features[0].geometry,
      symbol: polySym
    }));
   
  });
});

 

 

 

Graphic layer is displayed now when passing in just geometry of response features:

Outcomes