What's the simplest way to create a buffer round a circle. The current application creates a square buffer and I want it to reflect the circle shape. I've tried using getExtent but it just draws a square:
if (geometry.type === "polygon") {
var searchExtent = geometry.getExtent();
var biggerExtent = new esri.geometry.Extent(searchExtent.getExtent().expand(1));
wkid : 27700;
I also tried getCenter:
if (geometry.type === "polygon") {
var searchExtent = geometry.getExtent();
var centerPoint = newGeometry.getCenter();
var radius = newGeometry.getExtent().getWidth()/2;
var circleGeometry = new Circle(center, {"radius": radius});
wkid : 27700;
which returns an error. Can anyone help please?
Have you checked out this sample? Go down to the html and change LINE/POLYLINE/etc to CIRCLE.
<button data-dojo-type="dijit.form.Button" onclick="app.tb.activate(esri.toolbars.Draw.CIRCLE);app.map.hideZoomSlider();">Line</button>
This will allow you to draw a circle and apply a buffer.
Steven
I'm not sure why you're code errors out, but I modified this sample to work. It buffers or a point or the center of a polygon without using the geometry service.
JS Bin - Collaborative JavaScript Debugging
If you have some sample code of the issue, it may help.
Hi Rene
I've included the script here that I started with. I've tried the suggestions this morning but still finding it rather confusing - will stick at it and see what I can come up with - any help appreciated. Sample code here:
If you just want to add a circle (instand of a 'real' buffer), you could:
var firstCircle = new Circle(center, {blah});
var secondCircle = new Circle(firstCircle.center, {"radius": (firstCircle.radius +/- whatever)});
If you want to create a buffer, I would recommend creating it via BufferParameters and GeometryService.