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
+ (nullable AGSPolygon*) geodeticBufferGeometryAGSGeometry *) geometrydistance:(double) distancedistanceUnit:(AGSLinearUnit *) distanceUnitmaxDeviation:(double) maxDeviationcurveType:(AGSGeodeticCurveType) curveType
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
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!