This sample demonstrates how to perform geodesic operations on geometries using the GeometryEngine. Geodesic calculations take into account the curvature of the Earth, while planar calculations are based on a 2D Cartesian plane.
Visualizing flight paths between cities is a common example of a geodesic operation--notice the lines are not straight, but curved. A geodesic distance must be calculated to get an accurate real world distance between two points on a 2D map.
- Click anywhere on the map. A line graphic will display the geodesic line between the two points. In addition, text that indicates the geodesic distance between the two points will be updated.
- Click elsewhere and a new line will be created.
- A
Point
is created in New York City and displayed as aGraphic
. - When a click occurs on the
MapView
, a newPoint
is obtained from the mouse click. ThisPoint
is added as aGraphic
. - A
Polyline
is created with the twoPoint
objects. GeometryEngine.DensifyGeodetic
is executed by passing in thePolyline
object, and the returnedGeometry
is added as aGraphic
.GeometryEngine.LengthGeodetic
is executed by passing in the twoPoint
objects, and the returned number is displayed on the screen.
- GeometryEngine.DensifyGeodetic
- GeometryEngine.LengthGeodetic
GeometryEngine, densify, distance, geodesic, geodetic