|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object triptracker.core.Coordinate
public class Coordinate
Represents a coordinate in a latitude/longitude coordinate system on a given time and date. Data in a Coordinate object is immutable.
Latitude is numbered from 0 degrees to 90 degrees north and south. 0 degrees
is the equator, 90 degrees north is the North Pole and 90 degrees south is
the South Pole. The Coordinate
class numbers latitudes from -90
degrees to 90 degrees where -90 degrees is the South Pole and 90 degrees is
the North Pole.
Longitude is numbered from 0 degrees to 180 degrees east and west. 0 degrees
is at Greenwich, England and they continue 180 degrees east and 180 degrees
west where they meet at the International Date Line in the Pacific Ocean. The
Coordinate
class numbers longitude from -180 degrees to 180
degrees where negative degrees are west and positive degrees are east of
Greenwich, England at 0 degrees.
To precisely locate points on the earth's surface, degrees longitude and latitude have been divided into minutes (') and seconds ("). There are 60 minutes in each degree and each minute is divided into 60 seconds. Seconds can be further divided into tenths, hundredths, or even thousandths.
Field Summary | |
---|---|
static double |
EARTH_RADIUS
Earth radius. |
static double |
WGS84_A
See http://www.movable-type.co.uk/scripts/LatLongVincenty.html |
static double |
WGS84_B
|
static double |
WGS84_F
|
Constructor Summary | |
---|---|
Coordinate()
Default constructor. |
|
Coordinate(double latitude,
double longitude)
Creates a coordinate with the given latitude and longitude. |
|
Coordinate(double latitude,
double longitude,
Date date)
Creates a coordinate with the given latitude, longitude and date. |
|
Coordinate(int coordId,
double latitude,
double longitude)
|
|
Coordinate(int coordId,
double latitude,
double longitude,
Date date)
|
Method Summary | |
---|---|
static double |
cosineDist(Coordinate coord1,
Coordinate coord2)
Returns the distance between two points according to the law of cosines. |
static int |
decideZoneNum(double result,
double latitude)
Decides a UTM Zone Number for a given latitude and result. |
static double |
decOldToNmea(double degrees)
Deprecated. Replaced by decToNmea(double) to correct a
calculation error. |
static double |
decToNmea(double degrees)
Converts degrees in decimal format to NMEA sexagesimal format. |
int |
getCoordId()
Returns id of coordinate |
Date |
getDate()
Returns date of coordinate |
String |
getDateString()
Returns the time and date associated with the coordinate. |
String |
getStringLat()
Returns a string representation of the latitude |
String |
getStringLon()
Returns a string representation of the longitude |
double |
getX()
Returns the longitude position of the coordinate. |
double |
getY()
Returns the latitude position of the coordinate. |
double |
haversineDist(Coordinate coord)
Returns the Haversine distance from this to another coordinate. |
static double |
haversineDist(Coordinate coord1,
Coordinate coord2)
Returns the Haversine distance between two points. |
static double |
haversineDist(double lat1,
double lon1,
double lat2,
double lon2)
Returns the Haversine distance between two points. |
static double |
haversineDist(List<Coordinate> coords)
Returns the sequential Haverside distance between the coordinates. |
static UTMPoint |
llToUTM(int ellipsoidId,
double lat,
double lon)
Converts from lat/lon to a UTMpoint containting northing and easting plus zone with zone letter |
static double |
nmeaOldToDec(double degrees)
Deprecated. Replaced by nmeaToDec(double) to correct a
calculation error. |
static double |
nmeaToDec(double degrees)
Converts degrees in NMEA sexagesimal format to decimal format. |
static double |
sexToDec(int degrees,
int minutes,
double seconds)
Converts degrees in sexagesimal format to decimal format. |
static double |
sexToDec(Sexagesimal sex)
Converts degrees in sexagesimal format to decimal format. |
String |
toString()
Returns the string representation of a latitude/longitude coordinate. |
static Coordinate |
utmToLl(int ellipsoidId,
double northing,
double easting,
int zoneNum,
char zoneLetter)
|
static Coordinate |
utmToLl(int i,
UTMPoint utmpoint)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double EARTH_RADIUS
public static final double WGS84_A
public static final double WGS84_B
public static final double WGS84_F
Constructor Detail |
---|
public Coordinate()
public Coordinate(double latitude, double longitude)
getY()
and
getX()
respectively.
latitude
- latitude from 90 degrees (north) to -90 degrees (south)longitude
- longitude from 180 degrees (east) to -180 degrees (west)
IllegalArgumentException
- if latitude or longitude is out of
range.public Coordinate(double latitude, double longitude, Date date)
getY()
and getX()
respectively.
latitude
- latitude from 90 degrees (north) to -90 degrees (south)longitude
- longitude from 180 degrees (east) to -180 degrees (west)date
- time associated with coordinate
IllegalArgumentException
- if latitude or longitude is out of
range.public Coordinate(int coordId, double latitude, double longitude)
public Coordinate(int coordId, double latitude, double longitude, Date date)
Method Detail |
---|
public double getY()
public double getX()
public String getDateString()
public String toString()
toString
in class Object
Object.toString()
public String getStringLat()
public String getStringLon()
public static double sexToDec(Sexagesimal sex)
sex
- sexagesimal formatted angle
public static double sexToDec(int degrees, int minutes, double seconds)
degrees
- whole degreesminutes
- whole minutesseconds
- whole or fractional seconds
public static double decToNmea(double degrees)
degrees
- decimal degrees
@Deprecated public static double decOldToNmea(double degrees)
decToNmea(double)
to correct a
calculation error.
degrees
- decimal degrees
public static double nmeaToDec(double degrees)
degrees
- in NMEA sexagesimal format with degrees and minutes in
front of the decimal separator and seconds after
@Deprecated public static double nmeaOldToDec(double degrees)
nmeaToDec(double)
to correct a
calculation error.
degrees
- in NMEA sexagesimal format with degrees and minutes in
front of the decimal separator and seconds after
public double haversineDist(Coordinate coord)
coord
- destination coordinate
haversineDist(double, double, double, double)
public static double haversineDist(Coordinate coord1, Coordinate coord2)
coord1
- first coordinatecoord2
- secound coordinate
haversineDist(double, double, double, double)
public static double haversineDist(double lat1, double lon1, double lat2, double lon2)
lat1
- latitude of first coordinatelon1
- longitude of first coordinatelat2
- latitude of second coordinatelon2
- longitude of second coordinate
public static double haversineDist(List<Coordinate> coords)
coords
- list of coordinates used for distance calculation
haversineDist(double, double, double, double)
public static double cosineDist(Coordinate coord1, Coordinate coord2)
coord1
- first coordinatecoord2
- secound coordinate
public static UTMPoint llToUTM(int ellipsoidId, double lat, double lon)
ellipsoidId
- ellipsoid to use (i.e. WGS84 = 22)lat
- points latitudelon
- points longitude
public static Coordinate utmToLl(int i, UTMPoint utmpoint)
public static Coordinate utmToLl(int ellipsoidId, double northing, double easting, int zoneNum, char zoneLetter)
public static int decideZoneNum(double result, double latitude)
result
- resultlatitude
- latitude
public int getCoordId()
public Date getDate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |