<?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 GeometryService (2.0) buffer fails in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometryservice-2-0-buffer-fails/m-p/157468#M14716</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had a function that buffered a point clicked by the user. It worked fine in JSAPI 1.6, and still does. It worked OK in JSAPI 2.0 until a couple of days ago, though the code didn't change. I've had to roll back from 2.0 to 1.6 to keep working but I need to figure this out. Here's the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var geometryService = new esri.tasks.GeometryService(_thisMap.GeometryServiceUrl);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var params = new esri.tasks.BufferParameters();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.geometries = [centerPointGraphic.geometry];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.distances = [radius];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.unit = esri.tasks.GeometryService.UNIT_STATUTE_MILE;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.bufferSpatialReference = new esri.SpatialReference({ wkid: 4326 });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.outSpatialReference = new esri.SpatialReference({ wkid: 4326 });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.connect(geometryService, "onBufferComplete", this, "geometryBufferCompleteCallback");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geometryService.buffer(params);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I specify the geometries parameter using centerPointGraphic (as opposed to centerPointGraphic.geometry) (which I did in JSAPI 1.6), I get the error '_837[0].spatialReference is undefined'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I set the geometries parameter equal to centerPointGraphic.geometry, the geometryService.buffer call raises an error saying "TypeError: _943.toJson is not a function". It appears that the resulting geometry sees the distance as degrees, even though the units are specified as statute miles (I have tried specifying the units as esri.tasks.BufferParameters.UNIT_STATUTE_MILE (which worked in 1.6) and as esri.tasks.GeometryService.UNIT_STATUTE_MILE (which is in the samples) with the same results.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The input geometry is always a point graphic, with values like x = -93.60528441619863, y = 41.52957219910621. These parameters all work fine when I test the service in the server's ArcGIS/rest/services/Maps/Geometry/GeometryServer/buffer form.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anybody have any idea what I'm doing wrong here?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Oct 2010 15:27:26 GMT</pubDate>
    <dc:creator>TimRourke</dc:creator>
    <dc:date>2010-10-13T15:27:26Z</dc:date>
    <item>
      <title>GeometryService (2.0) buffer fails</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometryservice-2-0-buffer-fails/m-p/157468#M14716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had a function that buffered a point clicked by the user. It worked fine in JSAPI 1.6, and still does. It worked OK in JSAPI 2.0 until a couple of days ago, though the code didn't change. I've had to roll back from 2.0 to 1.6 to keep working but I need to figure this out. Here's the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var geometryService = new esri.tasks.GeometryService(_thisMap.GeometryServiceUrl);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var params = new esri.tasks.BufferParameters();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.geometries = [centerPointGraphic.geometry];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.distances = [radius];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.unit = esri.tasks.GeometryService.UNIT_STATUTE_MILE;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.bufferSpatialReference = new esri.SpatialReference({ wkid: 4326 });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.outSpatialReference = new esri.SpatialReference({ wkid: 4326 });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.connect(geometryService, "onBufferComplete", this, "geometryBufferCompleteCallback");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geometryService.buffer(params);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I specify the geometries parameter using centerPointGraphic (as opposed to centerPointGraphic.geometry) (which I did in JSAPI 1.6), I get the error '_837[0].spatialReference is undefined'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I set the geometries parameter equal to centerPointGraphic.geometry, the geometryService.buffer call raises an error saying "TypeError: _943.toJson is not a function". It appears that the resulting geometry sees the distance as degrees, even though the units are specified as statute miles (I have tried specifying the units as esri.tasks.BufferParameters.UNIT_STATUTE_MILE (which worked in 1.6) and as esri.tasks.GeometryService.UNIT_STATUTE_MILE (which is in the samples) with the same results.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The input geometry is always a point graphic, with values like x = -93.60528441619863, y = 41.52957219910621. These parameters all work fine when I test the service in the server's ArcGIS/rest/services/Maps/Geometry/GeometryServer/buffer form.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anybody have any idea what I'm doing wrong here?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Oct 2010 15:27:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometryservice-2-0-buffer-fails/m-p/157468#M14716</guid>
      <dc:creator>TimRourke</dc:creator>
      <dc:date>2010-10-13T15:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: GeometryService (2.0) buffer fails</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometryservice-2-0-buffer-fails/m-p/157469#M14717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The problem appears to be related to how Dojo is interpreting objects passed as parameters from one script to another, or in a callback. A center point graphic and a radius get passed to a function after a user enters a map point. Then for some reason, the buffer parameters object doesn't recognize either the graphic or its geometry as valid objects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been able to make this work by changing the script to explicitly create the geometry from the input object:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
function getCircleFromPoint(centerPointGraphic, radius)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; var geometryService = new esri.tasks.GeometryService(_thisMap.GeometryServiceUrl);
&amp;nbsp;&amp;nbsp;&amp;nbsp; var point = new esri.geometry.Point(centerPointGraphic.geometry.x,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; centerPointGraphic.geometry.y,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new esri.SpatialReference({ wkid: 4326 })
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );
&amp;nbsp;&amp;nbsp;&amp;nbsp; var params = new esri.tasks.BufferParameters();
&amp;nbsp;&amp;nbsp;&amp;nbsp; params.geometries = [point];
&amp;nbsp;&amp;nbsp;&amp;nbsp; params.distances = [new Number(radius)];
&amp;nbsp;&amp;nbsp;&amp;nbsp; params.unit = esri.tasks.GeometryService.UNIT_STATUTE_MILE;
&amp;nbsp;&amp;nbsp;&amp;nbsp; params.bufferSpatialReference = new esri.SpatialReference({ wkid: 4326 });
&amp;nbsp;&amp;nbsp;&amp;nbsp; params.outSpatialReference = map.spatialReference;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var obj = this;
&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.connect(geometryService, "onBufferComplete", obj, "geometryBufferCompleteCallback");
&amp;nbsp;&amp;nbsp;&amp;nbsp; geometryService.buffer(params);
}
&lt;/PRE&gt;&lt;SPAN&gt;The same problem prevented a QueryTask from executing with the circle produced by the buffer call. The solution there was to create a new Polygon and loop through the circle's rings, adding them to the new Polygon's rings and using the new Polygon in the query task.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:20:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometryservice-2-0-buffer-fails/m-p/157469#M14717</guid>
      <dc:creator>TimRourke</dc:creator>
      <dc:date>2021-12-11T08:20:34Z</dc:date>
    </item>
  </channel>
</rss>

