Package org.onlab.util
Class GeoLocation
- java.lang.Object
-
- org.onlab.util.GeoLocation
-
public class GeoLocation extends java.lang.ObjectGeo location specified in terms of longitude and latitude.
-
-
Field Summary
Fields Modifier and Type Field Description static doubleEARTH_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 doublekilometersTo(GeoLocation other)Returns the distance in kilometers, between this location and another.doublelatitude()Returns the latitude of this location.doublelongitude()Returns the longitude of this location.java.lang.StringtoString()
-
-
-
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:
toStringin classjava.lang.Object
-
-