|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.javadocmd.simplelatlng.LatLngTool
public class LatLngTool
Primary calculations and tools.
Note: distance calculations are done using the Haversine formula
which uses a spherical approximation of the Earth. Values are known
to differ from reality by as much as 0.3% so if complete accuracy is very
important to you, you should be using a different library. Furthermore,
by default this library uses the mean radius of the Earth (6371.009 km).
If your calculations are localized to a particular region of the Earth,
there may be values to use for this radius which will yield more accurate
results. To set the radius used by this library, see LatLngConfig.
| Method Summary | |
|---|---|
static double |
distance(LatLng point1,
LatLng point2,
LengthUnit unit)
Distance between two points. |
static double |
distanceInRadians(LatLng point1,
LatLng point2)
This "distance" function is mostly for internal use. |
static double |
initialBearing(LatLng start,
LatLng end)
Calculate the initial bearing in degrees on a great-circle course from one point to another. |
static double |
initialBearingInRadians(LatLng start,
LatLng end)
Calculate the initial bearing in radians on a great-circle course from one point to another. |
static double |
normalizeBearing(double bearing)
Convert a bearing to be within the 0 to +360 degrees range. |
static double |
normalizeLatitude(double latitude)
Clamp latitude to +/- 90 degrees. |
static double |
normalizeLongitude(double longitude)
Convert longitude to be within the +/- 180 degrees range. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static double distance(LatLng point1,
LatLng point2,
LengthUnit unit)
point1 - the first point.point2 - the second point.unit - the unit of measure in which to receive the result.
public static double distanceInRadians(LatLng point1,
LatLng point2)
This "distance" function is mostly for internal use. Most users will simply
rely upon distance(LatLng, LatLng, LengthUnit)
Yields the internal angle for an arc between two points on the surface of a sphere in radians. This angle is in the plane of the great circle connecting the two points measured from an axis through one of the points and the center of the Earth. Multiply this value by the sphere's radius to get the length of the arc.
public static double initialBearing(LatLng start,
LatLng end)
Calculate the initial bearing in degrees on a great-circle course from one point to another.
Remember, you can calculate the final bearing by swapping the start/end points and reversing the resulting "initial" bearing by adding or subtracting 180 degrees.
start - the starting point.end - the ending point.
public static double initialBearingInRadians(LatLng start,
LatLng end)
Calculate the initial bearing in radians on a great-circle course from one point to another.
Remember, you can calculate the final bearing by swapping the start/end points and reversing the resulting "initial" bearing by adding or subtracting 180 degrees.
start - the starting point.end - the ending point.
public static double normalizeLatitude(double latitude)
latitude - in degrees.
public static double normalizeLongitude(double longitude)
longitude - in degrees.
public static double normalizeBearing(double bearing)
bearing - the bearing in degrees.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||