<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JavaScript Buffer method gives TypeError b is undefined in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/javascript-buffer-method-gives-typeerror-b-is/m-p/807095#M5890</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; You need to specify the points spatial reference when you create it so that &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 14px;"&gt;geometryEngine.buffer knows what WKID it is dealing with. Actually I would use &lt;SPAN class="pln" style="color: #595959;"&gt;webMercatorUtils&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #595959;"&gt;geographicToWebMercator &lt;/SPAN&gt;to make the point a webmercator point before you add it to the map.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Apr 2016 14:15:49 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2016-04-19T14:15:49Z</dc:date>
    <item>
      <title>JavaScript Buffer method gives TypeError b is undefined</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/javascript-buffer-method-gives-typeerror-b-is/m-p/807094#M5889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I’m looking for some help with the buffer tool in the JavaScript API.&amp;nbsp; I have looked online but with no success.&amp;nbsp; I am getting a Latitude, a Longitude and a buffer distance from the user then attempting to buffer this point.&amp;nbsp; This is a custom widget that I'm creating in the Esri Web AppBuilder Developer Edition.&lt;/P&gt;&lt;P&gt;Here’s my code snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var dblLat = domAttr.get(this.inputLat, 'value');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var dblLong = domAttr.get(this.inputLong, 'value');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (dblLat =="" || dblLong =="" || isNaN(dblLat) || isNaN(dblLong)) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Message({message: this.nls.notANumber});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (this.pointLayer){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Remove old point layer from map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.map.graphics.remove(this.pointLayer);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("Placing point on the map.");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.ptLatLong = new Point(dblLong, dblLat);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; new Color([0,0,255]), 1),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; new Color([0,0,255]));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.pointLayer = new Graphic(this.ptLatLong, pointSymbol);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Add the point to the graphics layer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.map.graphics.add(this.pointLayer);&lt;/P&gt;&lt;P&gt;var bufferDistance = this.txtBufferDistance.value; &lt;/P&gt;&lt;P&gt;var bufferedGeometry = geometryEngine.buffer(this.ptLatLong,bufferDistance,'meters',true);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This fails at the last line with:&lt;/P&gt;&lt;P&gt;TypeError: b is undefined&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems to be a problem with the actual geometry, this.ptLatLong.&amp;nbsp; Elsewhere I have a similar line of code to buffer other geometries entered by the user and it works with no errors.&amp;nbsp; I've also tried geometryEngine.geodesicBuffer and this gives the same error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Apr 2016 00:48:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/javascript-buffer-method-gives-typeerror-b-is/m-p/807094#M5889</guid>
      <dc:creator>MarkNorbury</dc:creator>
      <dc:date>2016-04-19T00:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript Buffer method gives TypeError b is undefined</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/javascript-buffer-method-gives-typeerror-b-is/m-p/807095#M5890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; You need to specify the points spatial reference when you create it so that &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 14px;"&gt;geometryEngine.buffer knows what WKID it is dealing with. Actually I would use &lt;SPAN class="pln" style="color: #595959;"&gt;webMercatorUtils&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #595959;"&gt;geographicToWebMercator &lt;/SPAN&gt;to make the point a webmercator point before you add it to the map.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Apr 2016 14:15:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/javascript-buffer-method-gives-typeerror-b-is/m-p/807095#M5890</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-04-19T14:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript Buffer method gives TypeError b is undefined</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/javascript-buffer-method-gives-typeerror-b-is/m-p/807096#M5891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Robert.&amp;nbsp; That is what I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the line that I've amended in code, and it works now.&lt;/P&gt;&lt;P&gt;this.ptLatLong = webMercatorUtils.geographicToWebMercator(new Point(dblLong, dblLat));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Apr 2016 15:40:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/javascript-buffer-method-gives-typeerror-b-is/m-p/807096#M5891</guid>
      <dc:creator>MarkNorbury</dc:creator>
      <dc:date>2016-04-19T15:40:12Z</dc:date>
    </item>
  </channel>
</rss>

