Select to view content in your preferred language

Can I zoom into a polygon with buffer?

832
1
Jump to solution
02-21-2017 08:41 AM
LindaM
by
Emerging Contributor

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!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

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 

View solution in original post

1 Reply
RobertScheitlin__GISP
MVP Emeritus

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