Public Member Functions | |
| Coordinate (double latitude, double longitude) | |
| double | distanceTo (Coordinate other, char unit) |
| double | latitude () |
| double | longitude () |
| String | toString () |
Static Public Member Functions | |
| static double | distance (double lat1, double lon1, double lat2, double lon2, char unit) |
Static Public Attributes | |
| static final char | UNIT_KILOMETERS = 'K' |
| static final char | UNIT_NAUTICAL_MILES = 'N' |
| static final char | UNIT_STATUTE_MILES = 'M' |
Static Private Member Functions | |
| static double | deg2rad (double deg) |
| static double | rad2deg (double rad) |
Private Attributes | |
| double | latitude |
| double | longitude |
| Coordinate | ( | double | latitude, | |
| double | longitude | |||
| ) |
| static double deg2rad | ( | double | deg | ) | [static, private] |
| static double distance | ( | double | lat1, | |
| double | lon1, | |||
| double | lat2, | |||
| double | lon2, | |||
| char | unit | |||
| ) | [static] |
Calculate distance between two coordinates.
South latitudes are negative, east longitudes are positive.
Based on code from http://www.zipcodeworld.com/developers.htm
| lat1 | Latitude of point 1 (in decimal degrees) | |
| lon1 | Longitude of point 1 (in decimal degrees) | |
| lat2 | Latitude of point 2 (in decimal degrees) | |
| lon2 | Longitude of point 2 (in decimal degrees) | |
| unit | one of UNIT_STATUTE_MILES, UNIT_NAUTICAL_MILES or UNIT_KILOMETERS |
| double distanceTo | ( | Coordinate | other, | |
| char | unit | |||
| ) |
| double latitude | ( | ) |
| double longitude | ( | ) |
| static double rad2deg | ( | double | rad | ) | [static, private] |
| String toString | ( | ) |
double latitude [private] |
double longitude [private] |
final char UNIT_KILOMETERS = 'K' [static] |
final char UNIT_NAUTICAL_MILES = 'N' [static] |
final char UNIT_STATUTE_MILES = 'M' [static] |
1.5.8