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.
Tap 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. Tap elsewhere and a new line will be created.
Pointis created in New York City and displayed as a
- When a tap occurs on the
MapView, a new
Pointis obtained from the mouse click. This
Pointis added as a
Polylineis created with the two
GeometryEngine.DensifyGeodeticis executed by passing in the
Polylineobject, and the returned
Geometryis added as a
GeometryEngine.LengthGeodeticis executed by passing in the two
Pointobjects, and the returned number is displayed on the screen.
The Imagery basemap provides the global context for the displayed geodesic line.
densify, distance, geodesic, geodetic
<?xml version="1.0" encoding="utf-8" ?> <ContentPage x:Class="ArcGISRuntime.Samples.GeodesicOperations.GeodesicOperations" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:forms="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Label x:Name="ResultsLabel" Grid.Row="0" HorizontalTextAlignment="Center" TextColor="Red"> Tap to set an end point. </Label> <forms:MapView x:Name="MyMapView" Grid.Row="1" /> </Grid> </ContentPage>