Udostępnij za pośrednictwem


Location.DistanceBetween(Double, Double, Double, Double, Single[]) Method

Definition

Computes the approximate distance in meters between two locations, and optionally the initial and final bearings of the shortest path between them.

[Android.Runtime.Register("distanceBetween", "(DDDD[F)V", "")]
public static void DistanceBetween (double startLatitude, double startLongitude, double endLatitude, double endLongitude, float[]? results);
[<Android.Runtime.Register("distanceBetween", "(DDDD[F)V", "")>]
static member DistanceBetween : double * double * double * double * single[] -> unit

Parameters

startLatitude
Double

the starting latitude

startLongitude
Double

the starting longitude

endLatitude
Double

the ending latitude

endLongitude
Double

the ending longitude

results
Single[]

an array of floats to hold the results

Attributes

Exceptions

if results is null or has length

Remarks

Computes the approximate distance in meters between two locations, and optionally the initial and final bearings of the shortest path between them. Distance and bearing are defined using the WGS84 ellipsoid.

The computed distance is stored in results[0]. If results has length 2 or greater, the initial bearing is stored in results[1]. If results has length 3 or greater, the final bearing is stored in results[2].

Java documentation for android.location.Location.distanceBetween(double, double, double, double, float[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to