AnsweredAssumed Answered

Buffer around all geometries

Question asked by danwebb on Aug 22, 2014
Latest reply on Aug 26, 2014 by danwebb

I’m looking to create one buffer around multiple graphics.

 

The user clicks the desired polygons, which creates graphics matching the geometry of the polygons. After certain ones are picked I want to buffer around all of those with the same shape they all have together.  Below is the code I’m trying for the buffer.

 

It always break on gsvc.buffer(params, showBuffer); which makes me think there’s a problem with the params.

 

var geom = new Graphic();

geom = graphicsLayer.graphics;

var selectedGeom = graphicsUtils.getGeometries(geom);

var bufferDist = Math.floor(dom.byId("txtBufferDist").value);

 

var params = new BufferParameters();

params.geometries = [selectedGeom];

params.distances = [bufferDist];

params.unit = GeometryService.UNIT_FOOT;

params.outSpatialReference = bcMap.spatialReference;

gsvc.buffer(params, showBuffer);

 

function showBuffer(){

     //Code

}

 

HOWEVER, if I use graphicsUtils.graphicsExtent instead of graphicsUtils.getGeometries it works. But I don’t want a square every time. I want the buffer to follow the outline shape as seen in yellow.

 

Thanks for any help.

 

BufferExtent.PNG

Outcomes