Package org.onlab.util
Class GeoLocation
- java.lang.Object
-
- org.onlab.util.GeoLocation
-
public class GeoLocation extends java.lang.Object
Geo location specified in terms of longitude and latitude.
-
-
Field Summary
Fields Modifier and Type Field Description static double
EARTH_RADIUS_KM
-
Constructor Summary
Constructors Constructor Description GeoLocation(double latitude, double longitude)
Creates a new location using the specified coordinates.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
kilometersTo(GeoLocation other)
Returns the distance in kilometers, between this location and another.double
latitude()
Returns the latitude of this location.double
longitude()
Returns the longitude of this location.java.lang.String
toString()
-
-
-
Field Detail
-
EARTH_RADIUS_KM
public static final double EARTH_RADIUS_KM
- See Also:
- Constant Field Values
-
-
Method Detail
-
latitude
public double latitude()
Returns the latitude of this location.- Returns:
- latitude
-
longitude
public double longitude()
Returns the longitude of this location.- Returns:
- longitude
-
kilometersTo
public double kilometersTo(GeoLocation other)
Returns the distance in kilometers, between this location and another.- Parameters:
other
- other geo location- Returns:
- distance in kilometers
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-