AnsweredAssumed Answered

Spatial Reference undefined error when trying to buffer polygon

Question asked by sholyoak on May 3, 2012
Latest reply on May 3, 2012 by DSwingley-esristaff
I'm trying to buffer a polygon in my map, and I keep getting an "_a94[0].spatialReference is undefined" error from the 2.8 api js file.  I've verified that the spatialRef var is an actual spatial reference object.  I've verified that I have a valid geometry in that same spatial reference.  I've verified that my geometry service actually will return a polygon when buffering (though I've admittedly only tested a point that way).  My geoms var in my callback function always returns undefined.  I don't understand what's going on.  My code is below:

I call initializeBuffer on load.  Then bufferSelectedFeatures is called when the toolbar button is clicked.

Please help!

function initializeBuffer() {  bufferSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color("#234483")), new dojo.Color([0,255,0],0.25));  geomSvc = esri.config.defaults.geometryService;    bufferParams = new esri.tasks.BufferParameters();  bufferParams.unionResults = true;  bufferParams.unit = esri.tasks.GeometryService.UNIT_FOOT; }  function bufferSelectedFeatures() {  bufferParams.bufferSpatialReference = spatialRef;  bufferParams.outSpatialReference = spatialRef;  bufferParams.geometries = selectedFeatures;  var distances = [];  //TODO:change this to get the distance from the user  distances[0] = 200;  bufferParams.distances = distances;  geomSvc.buffer(bufferParams, bufferComplete); }  function bufferComplete(geoms) {  //convert geometries to graphics  dojo.forEach(geoms, function(geom){   var graphic = new esri.Graphic(geom, bufferSymbol);;  }); }