Modifier and Type | Field and Description |
---|---|
double |
latitude
The internal latitude value.
|
double |
longitude
The internal longitude value.
|
Constructor and Description |
---|
LatLong(double latitude,
double longitude)
Constructs a new LatLong with the given latitude and longitude values, measured in
degrees.
|
LatLong(java.lang.String wellKnownText)
Constructs a new LatLong from a Well-Known-Text (WKT) representation of a point.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(LatLong latLong)
This method is necessary for inserting LatLongs into tree data structures.
|
LatLong |
destinationPoint(double distance,
float bearing)
Returns the destination point from this point having travelled the given distance on the
given initial bearing (bearing normally varies around path followed).
|
double |
distance(LatLong other)
Calculate the Euclidean distance from this LatLong to another.
|
boolean |
equals(java.lang.Object obj) |
static LatLong |
fromMicroDegrees(int latitudeE6,
int longitudeE6)
Constructs a new LatLong with the given latitude and longitude values, measured in
microdegrees.
|
static LatLong |
fromString(java.lang.String latLonString)
Constructs a new LatLong from a comma-separated String containing latitude and
longitude values (also ';', ':' and whitespace work as separator).
|
double |
getLatitude()
Returns the latitude value of this coordinate.
|
int |
getLatitudeE6()
Returns the latitude value in microdegrees of this coordinate.
|
double |
getLongitude()
Returns the longitude value of this coordinate.
|
int |
getLongitudeE6()
Returns the longitude value in microdegrees of this coordinate.
|
int |
hashCode() |
double |
sphericalDistance(LatLong other)
Calculate the spherical distance from this LatLong to another.
|
java.lang.String |
toString() |
double |
vincentyDistance(LatLong other)
Calculate the spherical distance from this LatLong to another.
|
public final double latitude
public final double longitude
public LatLong(double latitude, double longitude) throws java.lang.IllegalArgumentException
latitude
- the latitude value in degrees.longitude
- the longitude value in degrees.java.lang.IllegalArgumentException
- if the latitude or longitude value is invalid.public LatLong(java.lang.String wellKnownText)
wellKnownText
- is the WKT point which describes the new LatLong, this needs to be in
degrees using a WGS84 representation. The coordinate order in the POINT is
defined as POINT(long lat).public int compareTo(LatLong latLong)
compareTo
in interface java.lang.Comparable<LatLong>
public LatLong destinationPoint(double distance, float bearing)
distance
- the distance travelled, in same units as earth radius (default: meters)bearing
- the initial bearing in degrees from northpublic double distance(LatLong other)
other
- The LatLong to calculate the distance topublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static LatLong fromMicroDegrees(int latitudeE6, int longitudeE6)
latitudeE6
- the latitude value in microdegrees.longitudeE6
- the longitude value in microdegrees.java.lang.IllegalArgumentException
- if the latitudeE6 or longitudeE6 value is invalid.public static LatLong fromString(java.lang.String latLonString)
latLonString
- the String containing the latitude and longitude valuesjava.lang.IllegalArgumentException
- if the latLonString could not be interpreted as a coordinatepublic double getLatitude()
public int getLatitudeE6()
public double getLongitude()
public int getLongitudeE6()
public int hashCode()
hashCode
in class java.lang.Object
public double sphericalDistance(LatLong other)
other
- The LatLong to calculate the distance topublic java.lang.String toString()
toString
in class java.lang.Object
public double vincentyDistance(LatLong other)
other
- The LatLong to calculate the distance to