LocationDistanceBetween

float LocationDistanceBetween(float lat1, float lng1, float lat2, float lng2);

 

Returns the distance (in meters) between two points on the globe.

 

Return Value

 

Returns a non-zero value if the call was successful, zero otherwise.

 

Parameters

 

lat1

The latitude of the first point to which you wish to calculate distance.

 

lng1

The longitude of the first point to which you wish to calculate distance.

 

lat2

The latitude of the second point to which you wish to calculate distance.

 

lng2

The longitude of the second point to which you wish to calculate distance.

 

Remarks

 

LocationDistanceBetween() returns the distance (in meters) between two discrete points on the globe.  Each point is specified by a pair of floating point values representing latitude and longitude.

 

NOTE: this function is effective on the device only.

 

Availability

 

Available in DragonFireSDK 1.4 and later.

 

Example

 

#include "DragonFireSDK.h"

 

int MyFont;

float Dist;

char TextBuffer[100];

 

void AppMain()

{

  LandscapeMode();

  MyFont = FontAdd("Helvetica", "Regular", 24, 0x00FF00);

  Dist = LocationDistanceBetween(37.33294444f, -122.0325556f, 0.0f, 0.0f);

  sprintf(TextBuffer, "Cupertino to Equator: %fm", Dist);

  TextAdd(10, 10, TextBuffer, MyFont);

}

 

//===============================================

void OnTimer()

{

}

 

//===============================================

void AppExit()

{

 

}