Package com.iizix.geo
Interface ILongitudeLatitude
- All Known Subinterfaces:
- ILongitudeLatitudeAltitude
- All Known Implementing Classes:
- GeoLocation,- RegionLocation
public interface ILongitudeLatitude
Interface used for geolocation with longitude and latitude.
Programming note: DO NOT COMPARE WITH Double.NaN as e.g. value==Double.NaN, use Double.isNaN(double)
- Author:
- Christopher Mindus
- Field SummaryFields
- Method SummaryModifier and TypeMethodDescription- static double- getDistance- (double longitude1, double longitude2, double latitude1, double latitude2) Calculate distance between two points in latitude and longitude.- default double- getDistance- (ILongitudeLatitude location) Gets the distance in meters between this location and another.- doubleGets the latitude.- doubleGets the longitude.
- Field Details- EARTH_RADIUSstatic final double EARTH_RADIUSRadius of the earth.- See Also:
 
 
- Method Details- getDistancestatic double getDistance- (double longitude1, double longitude2, double latitude1, double latitude2) Calculate distance between two points in latitude and longitude. Uses Haversine method as its base.- Parameters:
- longitude1- Longitude 1.
- longitude2- Longitude 2.
- latitude1- Latitude 1.
- latitude2- Latitude 2.
- Returns:
- Distance in Meters, or Double.NaN if either values are Double.isNaN().
 
- getLongitudedouble getLongitude()Gets the longitude.- Returns:
- The longitude, or NaN if value is not present.
 
- getLatitudedouble getLatitude()Gets the latitude.- Returns:
- The latitude, or NaN if value is not present.
 
- getDistanceGets the distance in meters between this location and another.- Parameters:
- location- The other location.
- Returns:
- Distance in meters, Double.NaN if longitude/latitude values are not present.