I need to let the map zoom into a free-draw polygon’s buffer; the buffer can be 10 – 100 miles defined by the users, the buffer value is defined as BufferDistance.
I know for a circle with buffer, it can be defined such as
var circleBuffer = new Circle(centerPoint, {
"radius": this.circle.radiusValue
});
And then the map extent is set as:
this.map.setExtent(circleBuffer.getExtent());
I test this circle statement, it can zoom into the circle buffer very well.
My question is: what if I want to zoom into a free-draw polygon with buffer? How do I get the extent of this polygon with buffer (not just polygon itself)? In esri/geometry domain, a polygon constructor does not include any optional parameter like radius/buffer. I tried the following:
this.map.setExtent(polygon.geometry.getExtent());
It can only zoom into the polygon itself, not the polygon buffer. Thanks!
Solved! Go to Solution.
Linda,
You have to use the GeometryService buffer method first and use the returned promise to set the maps extent.
GeometryService | API Reference | ArcGIS API for JavaScript 3.19 | buffer
Linda,
You have to use the GeometryService buffer method first and use the returned promise to set the maps extent.
GeometryService | API Reference | ArcGIS API for JavaScript 3.19 | buffer