This sample demonstrates how to use AGSGeometryEngine to calculate a geodesic path between two points and measure its distance. Geodesic calculations take into account the curvature of the Earth, while planar calculations are based on a 2D Cartesian plane.
How it works
- Create an instance of AGSPolyline using two points.
- Densify the Polyline using the geodeticDensifyGeometry(_:maxSegmentLength:lengthUnit:curveType:) method on AGSGeometryEngine. This method will return a geodetically densified geometry.
- Set this geometry to a Graphic to display the geodesic path between two points in a Graphics Overlay.
- Get the geodetic distance of the path using the geodeticLength(of:lengthUnit:curveType:) method on AGSGeometryEngine.