AnsweredAssumed Answered

JavaScript Buffer method gives TypeError b is undefined

Question asked by mnorburyesri-ca-esridist Employee on Apr 18, 2016
Latest reply on Apr 19, 2016 by mnorburyesri-ca-esridist

I’m looking for some help with the buffer tool in the JavaScript API.  I have looked online but with no success.  I am getting a Latitude, a Longitude and a buffer distance from the user then attempting to buffer this point.  This is a custom widget that I'm creating in the Esri Web AppBuilder Developer Edition.

Here’s my code snippet.

 

var dblLat = domAttr.get(this.inputLat, 'value');

    var dblLong = domAttr.get(this.inputLong, 'value');

    if (dblLat =="" || dblLong =="" || isNaN(dblLat) || isNaN(dblLong)) {

     new Message({message: this.nls.notANumber});

     return;

    }

    if (this.pointLayer){

     //Remove old point layer from map.

     this.map.graphics.remove(this.pointLayer);

    }

    console.log("Placing point on the map.");

    this.ptLatLong = new Point(dblLong, dblLat);

    var pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10,

   new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,

   new Color([0,0,255]), 1),

   new Color([0,0,255]));

    this.pointLayer = new Graphic(this.ptLatLong, pointSymbol);

    //Add the point to the graphics layer.

    this.map.graphics.add(this.pointLayer);

var bufferDistance = this.txtBufferDistance.value;

var bufferedGeometry = geometryEngine.buffer(this.ptLatLong,bufferDistance,'meters',true);

 

This fails at the last line with:

TypeError: b is undefined

 

It seems to be a problem with the actual geometry, this.ptLatLong.  Elsewhere I have a similar line of code to buffer other geometries entered by the user and it works with no errors.  I've also tried geometryEngine.geodesicBuffer and this gives the same error.

 

Any help would be appreciated.  Thanks.

Outcomes