Calculate a geodesic path between two points and measure its distance.
A geodesic distance provides an accurate, real-world distance between two points. Visualizing flight paths between cities is a common example of a geodesic operation since the flight path between two airports takes into account the curvature of the earth, rather than following the planar path between those points, which appears as a straight line on a projected 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 called from thePolyline
object, and the returnedGeometry
is stored aspathGeometry
.GeometryEngine.LengthGeodetic
is called frompathGeometry
, and the returned number is displayed on the screen.
- GeometryEngine.DensifyGeodetic
- GeometryEngine.LengthGeodetic
The Imagery basemap provides the global context for the displayed geodesic line.
densify, distance, geodesic, geodetic