AGSPolygon Border or Buffer

407
1
06-26-2019 08:08 AM
JaiByron
New Contributor

I'm developing an app in Swift where I need to draw an outline around a Polygon.

At the moment I'm using the following API

https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_geometry_engine.html#af776cf7...

+ (nullable AGSPolygon*) geodeticBufferGeometryAGSGeometry *) geometrydistance:(double) distancedistanceUnit:(AGSLinearUnit *) distanceUnitmaxDeviation:(double) maxDeviationcurveType:(AGSGeodeticCurveTypecurveType 

The problem for me is that it produces a buffer of constant distance around my original AGSGeometry (which in this case happens to be an AGSPolygon) rather than an outline. This manifests as an issue in the following situation:

1. Original polygon outlining an area.

2. After running the geodeticBufferGeometry function to get a new AGSPolygon and drawing them I see the following:

Rounded corners on the edges of the shape where you have right-angles. Which is to be expected when calculating buffer points at a corner.

Is there an API within the SDK I can call that would give me a border rather than a buffer as shown here :

Thanks

0 Kudos
1 Reply
Nicholas-Furness
Esri Regular Contributor

Hi Jai.

We just got this moved to the right place. Sorry we didn't see the question sooner.

You should use the AGSGeometryEngine.offset() method.‌

I used:

let newPolygon = AGSGeometryEngine.offsetGeometry(geom, distance: -50,
                                                  offsetType: .squared,
                                                  bevelRatio: 1,
                                                  flattenError: 0) as? AGSPolygon‍‍‍‍

 

and got the following result (the cyan polygon was the original input):

See the documentation to understand why the distance is -ve in this case.

Hope this helps!

0 Kudos