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:
var geometryService = new esri.tasks.GeometryService(_thisMap.GeometryServiceUrl);
var params = new esri.tasks.BufferParameters();
params.geometries = [centerPointGraphic.geometry];
params.distances = [radius];
params.unit = esri.tasks.GeometryService.UNIT_STATUTE_MILE;
params.bufferSpatialReference = new esri.SpatialReference({ wkid: 4326 });
params.outSpatialReference = new esri.SpatialReference({ wkid: 4326 });
dojo.connect(geometryService, "onBufferComplete", this, "geometryBufferCompleteCallback");
geometryService.buffer(params);
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'.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.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.Does anybody have any idea what I'm doing wrong here?